diff options
Diffstat (limited to 'lib/some/messages.rb')
-rw-r--r-- | lib/some/messages.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/some/messages.rb b/lib/some/messages.rb index 5e2ff48..9f2520b 100644 --- a/lib/some/messages.rb +++ b/lib/some/messages.rb @@ -44,8 +44,10 @@ module Some end attr_accessor :query, :current_conjuction, :token_count + attr_reader :db - def initialize + def initialize(db:) + @db = db @query = [] @current_conjuction = AND_CONJUCTION @token_count = 0 @@ -72,6 +74,12 @@ module Some self end + def each + db.search_messages(query_string).each do |msg| + yield(Message.new(msg: msg)) + end + end + def add_filter_from_string(string) @query << Token.new(current_conjuction, :direct, string, self) end |