aboutsummaryrefslogtreecommitdiff
path: root/lib/chotto.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chotto.rb')
-rw-r--r--lib/chotto.rb10
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/chotto.rb b/lib/chotto.rb
index 6e1f908..71a1ac8 100644
--- a/lib/chotto.rb
+++ b/lib/chotto.rb
@@ -9,7 +9,6 @@ require_relative 'chotto/helpers'
require_relative 'chotto/message'
require_relative 'chotto/messages'
require_relative 'chotto/ruleset'
-require_relative 'chotto/tags'
module Chotto
class << self
@@ -18,15 +17,16 @@ module Chotto
def configure(&block)
@config ||= Config.new
+ @config.db_class = ::Notmuch::Database
@rule_sets = []
instance_eval(&block)
- @db = Database.new(path: config.database_path)
+ @db = Database.new(path: config.database_path, db_class: config.db_class)
end
def rule_set(name, &block)
- @rule_sets << RuleSet.new(name, block)
+ @rule_sets << RuleSet.new(name, db, block)
end
def close_db
@@ -36,8 +36,6 @@ module Chotto
end
def eval_rules
- Chotto.rule_sets.each do |rule_set|
- rule_set.run
- end
+ Chotto.rule_sets.each(&:run)
Chotto.close_db
end