diff options
Diffstat (limited to 'lib/osugiru')
-rw-r--r-- | lib/osugiru/database.rb | 2 | ||||
-rw-r--r-- | lib/osugiru/message.rb | 17 |
2 files changed, 16 insertions, 3 deletions
diff --git a/lib/osugiru/database.rb b/lib/osugiru/database.rb index d014c94..0d33a24 100644 --- a/lib/osugiru/database.rb +++ b/lib/osugiru/database.rb @@ -5,7 +5,7 @@ module Osugiru attr_reader :db def initialize(path:) - @db = ::Notmuch::Database.new(path) + @db = ::Notmuch::Database.new(path, mode: Notmuch::MODE_READ_WRITE) end def query(query) diff --git a/lib/osugiru/message.rb b/lib/osugiru/message.rb index 3446f17..0555724 100644 --- a/lib/osugiru/message.rb +++ b/lib/osugiru/message.rb @@ -6,9 +6,10 @@ module Osugiru def initialize(msg:) @message = msg + @tags = @message.tags end - def method_missing(method_name, *_args) + def method_missing(method_name, *_args) handle_get(Osugiru::Helpers.header_name_from_dsl(method_name)) end @@ -17,7 +18,19 @@ module Osugiru end def tags - @message.tags + @tags + end + + def tags=(new_tags) + @tags = new_tags + end + + def save! + message.remove_all_tags + tags.each do |tag| + message.add_tag(tag) + end + binding.pry end end end |