module Chatterbot::Search

handle Twitter searches

Constants

MAX_SEARCH_TWEETS

set a reasonable limit on the maximum number of tweets we will ever return. otherwise it is possible to exceed Twitter's rate limits

Public Instance Methods

exclude_retweets() click to toggle source

exclude retweets from searches

# File lib/chatterbot/search.rb, line 16
def exclude_retweets
  @skip_retweets = true
end
include_retweets() click to toggle source

include retweets from searches

# File lib/chatterbot/search.rb, line 23
def include_retweets
  @skip_retweets = false
end
skippable_retweet?(t) click to toggle source

check if this is a retweet that we want to skip

# File lib/chatterbot/search.rb, line 31
def skippable_retweet?(t)
  @skip_retweets && t.retweeted_status?
end
wrap_search_query(q) click to toggle source
# File lib/chatterbot/search.rb, line 35
def wrap_search_query(q)
  if q =~ / /
    ['"', q.gsub(/^"/, '').gsub(/"$/, ''), '"'].join("")
  else
    q
  end
end