From 7a39066fa6020a2349c640588d295d74f473945e Mon Sep 17 00:00:00 2001 From: mms Date: Tue, 12 Nov 2024 23:56:29 +0100 Subject: feat: save DB after rules eval --- lib/chotto.rb | 5 +++++ lib/chotto/database.rb | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/lib/chotto.rb b/lib/chotto.rb index 6afcf35..6e1f908 100644 --- a/lib/chotto.rb +++ b/lib/chotto.rb @@ -28,6 +28,10 @@ module Chotto def rule_set(name, &block) @rule_sets << RuleSet.new(name, block) end + + def close_db + db.close + end end end @@ -35,4 +39,5 @@ def eval_rules Chotto.rule_sets.each do |rule_set| rule_set.run end + Chotto.close_db end diff --git a/lib/chotto/database.rb b/lib/chotto/database.rb index 2379b0b..893c970 100644 --- a/lib/chotto/database.rb +++ b/lib/chotto/database.rb @@ -15,5 +15,9 @@ module Chotto def search_messages(query) query(query).search_messages end + + def close + db.close + end end end -- cgit v1.2.3