# 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