diff options
author | mms <git@sapka.me> | 2024-11-12 23:36:48 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-11-12 23:36:48 +0100 |
commit | 6d3ab5f655c83f78905dccede27e5b1da22cc97c (patch) | |
tree | a19a544d059e1efe43650672a7842945a361548d /lib | |
parent | c65e4885b999e90732bf37ee954540bae58a4880 (diff) |
test: add specs to Mesage class
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chotto.rb | 2 | ||||
-rw-r--r-- | lib/chotto/database.rb | 2 | ||||
-rw-r--r-- | lib/chotto/message.rb | 15 | ||||
-rw-r--r-- | lib/chotto/tags.rb | 12 |
4 files changed, 10 insertions, 21 deletions
diff --git a/lib/chotto.rb b/lib/chotto.rb index 47a94c0..6afcf35 100644 --- a/lib/chotto.rb +++ b/lib/chotto.rb @@ -36,5 +36,3 @@ def eval_rules rule_set.run end end - - diff --git a/lib/chotto/database.rb b/lib/chotto/database.rb index 78b80fe..2379b0b 100644 --- a/lib/chotto/database.rb +++ b/lib/chotto/database.rb @@ -5,7 +5,7 @@ module Chotto attr_reader :db def initialize(path:) - @db = ::Notmuch::Database.new(path, mode: Notmuch::MODE_READ_WRITE) + @db = ::Notmuch::Database.new(path, mode: Notmuch::MODE_READ_WRITE) end def query(query) diff --git a/lib/chotto/message.rb b/lib/chotto/message.rb index ce7c067..ff382f8 100644 --- a/lib/chotto/message.rb +++ b/lib/chotto/message.rb @@ -2,6 +2,7 @@ module Chotto class Message + attr_accessor :tags attr_reader :message def initialize(msg:) @@ -9,22 +10,14 @@ module Chotto @tags = @message.tags end - def method_missing(method_name, *_args) - handle_get(Chotto::Helpers.header_name_from_dsl(method_name)) - end + def method_missing(method_name, *_args) + handle_get(Chotto::Helpers.header_name_from_dsl(method_name)) + end def handle_get(header_name) message.header(header_name) if message.header(header_name) end - def tags - @tags - end - - def tags=(new_tags) - @tags = new_tags - end - def save! message.remove_all_tags tags.each do |tag| diff --git a/lib/chotto/tags.rb b/lib/chotto/tags.rb index 3a4fb14..52caeec 100644 --- a/lib/chotto/tags.rb +++ b/lib/chotto/tags.rb @@ -1,18 +1,16 @@ module Chotto class Tags - include Enumerable + include Enumerable - attr_accessor :tags, :message + attr_accessor :tags, :message def initialize(tags:, message:) @tags = tags @messae = message end - def each(&block) - tags.each(&block) - end + def each(&block) + tags.each(&block) + end end - - end |