aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-27 20:50:16 +0100
committermms <git@sapka.me>2024-11-27 20:50:16 +0100
commit1354fcfd222a922762999cd6a97dfe5845d4f835 (patch)
tree44522c5d6eddcd58e98f8507c274a8c1ca351112 /lib
parent4c911a441e9533b5bb323b26be748abfd4c5d316 (diff)
Diffstat (limited to 'lib')
-rw-r--r--lib/chotto.rb5
-rw-r--r--lib/chotto/helpers.rb2
-rw-r--r--lib/chotto/message.rb11
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|