diff options
author | mms <git@sapka.me> | 2024-11-12 23:23:01 +0100 |
---|---|---|
committer | mms <git@sapka.me> | 2024-11-12 23:23:01 +0100 |
commit | c65e4885b999e90732bf37ee954540bae58a4880 (patch) | |
tree | a9e22b04c7306dc4f292ae22469c3f136ac9611f /lib | |
parent | 53112538e1f47ed446848c5787a87350a2cc6e31 (diff) |
feat: rename, again
Diffstat (limited to 'lib')
-rw-r--r-- | lib/chotto.rb (renamed from lib/osugiru.rb) | 20 | ||||
-rw-r--r-- | lib/chotto/config.rb (renamed from lib/osugiru/config.rb) | 2 | ||||
-rw-r--r-- | lib/chotto/database.rb (renamed from lib/osugiru/database.rb) | 2 | ||||
-rw-r--r-- | lib/chotto/helpers.rb (renamed from lib/osugiru/helpers.rb) | 2 | ||||
-rw-r--r-- | lib/chotto/message.rb (renamed from lib/osugiru/message.rb) | 7 | ||||
-rw-r--r-- | lib/chotto/messages.rb (renamed from lib/osugiru/messages.rb) | 3 | ||||
-rw-r--r-- | lib/chotto/ruleset.rb (renamed from lib/osugiru/ruleset.rb) | 4 | ||||
-rw-r--r-- | lib/chotto/tags.rb | 18 |
8 files changed, 37 insertions, 21 deletions
diff --git a/lib/osugiru.rb b/lib/chotto.rb index 4e99212..47a94c0 100644 --- a/lib/osugiru.rb +++ b/lib/chotto.rb @@ -3,15 +3,15 @@ require 'notmuch' require 'pry' -require_relative 'osugiru/config' -require_relative 'osugiru/database' -require_relative 'osugiru/helpers' -require_relative 'osugiru/message' -require_relative 'osugiru/messages' -require_relative 'osugiru/ruleset' -require_relative 'osugiru/tags' - -module Osugiru +require_relative 'chotto/config' +require_relative 'chotto/database' +require_relative 'chotto/helpers' +require_relative 'chotto/message' +require_relative 'chotto/messages' +require_relative 'chotto/ruleset' +require_relative 'chotto/tags' + +module Chotto class << self attr_accessor :config attr_reader :db, :rule_sets @@ -32,7 +32,7 @@ module Osugiru end def eval_rules - Osugiru.rule_sets.each do |rule_set| + Chotto.rule_sets.each do |rule_set| rule_set.run end end diff --git a/lib/osugiru/config.rb b/lib/chotto/config.rb index 033d501..267e72c 100644 --- a/lib/osugiru/config.rb +++ b/lib/chotto/config.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Osugiru +module Chotto class Config attr_accessor :database_path end diff --git a/lib/osugiru/database.rb b/lib/chotto/database.rb index 0d33a24..78b80fe 100644 --- a/lib/osugiru/database.rb +++ b/lib/chotto/database.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Osugiru +module Chotto class Database attr_reader :db diff --git a/lib/osugiru/helpers.rb b/lib/chotto/helpers.rb index c493bbd..02ee81e 100644 --- a/lib/osugiru/helpers.rb +++ b/lib/chotto/helpers.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Osugiru +module Chotto module Helpers def self.header_name_from_dsl(method_name) method_name diff --git a/lib/osugiru/message.rb b/lib/chotto/message.rb index 0555724..ce7c067 100644 --- a/lib/osugiru/message.rb +++ b/lib/chotto/message.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Osugiru +module Chotto class Message attr_reader :message @@ -10,8 +10,8 @@ module Osugiru end def method_missing(method_name, *_args) - handle_get(Osugiru::Helpers.header_name_from_dsl(method_name)) - end + 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) @@ -30,7 +30,6 @@ module Osugiru tags.each do |tag| message.add_tag(tag) end - binding.pry end end end diff --git a/lib/osugiru/messages.rb b/lib/chotto/messages.rb index 4af19b6..7326148 100644 --- a/lib/osugiru/messages.rb +++ b/lib/chotto/messages.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true -require 'pry' -module Osugiru +module Chotto class Messages AND_CONJUCTION = :and OR_CONJUCTION = :or diff --git a/lib/osugiru/ruleset.rb b/lib/chotto/ruleset.rb index a9bac16..289aa2f 100644 --- a/lib/osugiru/ruleset.rb +++ b/lib/chotto/ruleset.rb @@ -1,7 +1,7 @@ -module Osugiru +module Chotto RuleSet = Struct.new(:name, :rule) do def messages - Messages.new(db: Osugiru.db) + Messages.new(db: Chotto.db) end def run diff --git a/lib/chotto/tags.rb b/lib/chotto/tags.rb new file mode 100644 index 0000000..3a4fb14 --- /dev/null +++ b/lib/chotto/tags.rb @@ -0,0 +1,18 @@ +module Chotto + class Tags + include Enumerable + + attr_accessor :tags, :message + + def initialize(tags:, message:) + @tags = tags + @messae = message + end + + def each(&block) + tags.each(&block) + end + end + + +end |