Sha256: fe9a6e97d9e3da9d47d9811ecfb2d0f031c1e768fb7caff38ea83b699db03757

Contents?: true

Size: 670 Bytes

Versions: 2

Compression:

Stored size: 670 Bytes

Contents

module Chatterbot

  #
  # handle Twitter searches
  module Search

    # internal search code
    def search(queries, &block)
      return unless init_client
      
      debug "check for tweets since #{since_id}"

      if queries.is_a?(String)
        queries = [queries]
      end
      
      #
      # search twitter
      #
      queries.each { |query|
        search = client.search(query, default_opts)
        update_since_id(search)

        if search != nil
          search["results"].each { |s|
            s.symbolize_keys!
            yield s unless ! block_given? || on_blacklist?(s) || skip_me?(s)
          }
        end
      }
    end
  
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chatterbot-0.2.1 lib/chatterbot/search.rb
chatterbot-0.2.0 lib/chatterbot/search.rb