aboutsummaryrefslogtreecommitdiff
path: root/lib/some.rb
diff options
context:
space:
mode:
authormms <git@sapka.me>2024-11-07 14:57:41 +0100
committermms <git@sapka.me>2024-11-07 14:57:41 +0100
commitacc8415d7109e8fb45bbfcd8cf545ebcf5b5d16a (patch)
tree1c8b1ec2efbd7602fa972aa7dbd6e8baa63ef515 /lib/some.rb
init spike
Diffstat (limited to 'lib/some.rb')
-rw-r--r--lib/some.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/some.rb b/lib/some.rb
new file mode 100644
index 0000000..7e1dbdb
--- /dev/null
+++ b/lib/some.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+require 'notmuch'
+require 'pry'
+
+require_relative 'some/database'
+require_relative 'some/message'
+require_relative 'some/messages'
+require_relative 'some/helpers'
+
+module Some
+ class Some
+ def initialize
+ @db = Database.new(path: '/home/mms/mail')
+ end
+
+ def with_filter(filter_string)
+ db.query(filter_string).search_messages.each do |msg|
+ yield Message.new(msg: msg)
+ end
+ rescue StandardError => e
+ p e
+ end
+
+ private
+
+ attr_reader :db
+ end
+end
+
+p Some::Messages.new
+ .filter(from: 'janek', tags: [1, 2])
+ .or.filter(subject: 'a')
+ .query_string