lib/chatterbot/search.rb in chatterbot-0.7.1 vs lib/chatterbot/search.rb in chatterbot-0.9.0

- old
+ new

@@ -16,25 +16,31 @@ debug "check for tweets since #{since_id}" if queries.is_a?(String) queries = [queries] end + # # search twitter # queries.each { |query| - debug "search: #{query} #{opts.merge(default_opts)}" - result = search_client.search( + debug "search: #{query} #{default_opts.merge(opts)}" + result = client.search( exclude_retweets(query), - opts.merge(default_opts) + default_opts.merge(opts) ) - update_since_id(result.max_id) + update_since_id(result) - result.collection.each { |s| + @current_tweet = nil + result.each { |s| debug s.text - yield s unless ! block_given? || on_blacklist?(s) || skip_me?(s) + if block_given? && !on_blacklist?(s) && !skip_me?(s) + @current_tweet = s + yield s + end } + @current_tweet = nil } end end end