blob: 7e1dbdb5fc694936921e3adb73b2a186db26aa5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
|