diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chotto.rb | 5 | ||||
-rw-r--r-- | lib/chotto/helpers.rb | 2 | ||||
-rw-r--r-- | lib/chotto/message.rb | 11 |
3 files changed, 13 insertions, 5 deletions
diff --git a/lib/chotto.rb b/lib/chotto.rb index 434002c..f6b9cac 100644 --- a/lib/chotto.rb +++ b/lib/chotto.rb @@ -3,16 +3,17 @@ require 'notmuch' require 'pry' +require_relative '../filters/mailing_lists_filter' +require_relative '../filters/spam_filter' require_relative 'chotto/config' require_relative 'chotto/database' require_relative 'chotto/helpers' require_relative 'chotto/message' +require_relative 'chotto/message_thread' require_relative 'chotto/messages' require_relative 'chotto/ruleset' require_relative 'chotto/token' require_relative 'chotto/token_group' -require_relative 'chotto/message_thread' -require_relative '../filters/mailing_lists_filter' module Chotto class << self diff --git a/lib/chotto/helpers.rb b/lib/chotto/helpers.rb index 02ee81e..598b207 100644 --- a/lib/chotto/helpers.rb +++ b/lib/chotto/helpers.rb @@ -6,7 +6,7 @@ module Chotto method_name .to_s .split('_') - .map(&:capitalize) + .map(&:downcase) .join('-') end end diff --git a/lib/chotto/message.rb b/lib/chotto/message.rb index cc3a134..82d77a4 100644 --- a/lib/chotto/message.rb +++ b/lib/chotto/message.rb @@ -3,18 +3,25 @@ module Chotto class Message attr_reader :message, :messages, :db - attr_accessor :tags + + # attr_accessor :tags def initialize(msg:, db:) @message = msg @db = db - @tags = @message.tags + # @tags = MessageTags.new(message: message) end def method_missing(method_name, *_args) handle_get_header(Chotto::Helpers.header_name_from_dsl(method_name)) end + def tags + @tags ||= message.tags + end + + attr_writer :tags + def save! message.remove_all_tags tags.each do |tag| |