aboutsummaryrefslogtreecommitdiff
path: root/lib/some.rb
diff options
context:
space:
mode:
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