class Ruboty::TwitterSearch::Query

Constants

DEFAULT_MINIMUM_FAVORITE_COUNT
DEFAULT_MINIMUM_RETWEET_COUNT

Public Class Methods

new(original_query_string) click to toggle source

@param [String] original_query_string

# File lib/ruboty/twitter_search/query.rb, line 10
def initialize(original_query_string)
  @original_query_string = original_query_string
end

Public Instance Methods

minimum_favorite_count() click to toggle source

@return [Fixnum]

# File lib/ruboty/twitter_search/query.rb, line 15
def minimum_favorite_count
  if token = tokens.find(&:favorite_count_filter?)
    token.favorite_count
  else
    DEFAULT_MINIMUM_FAVORITE_COUNT
  end
end
minimum_retweet_count() click to toggle source

@return [Fixnum]

# File lib/ruboty/twitter_search/query.rb, line 24
def minimum_retweet_count
  if token = tokens.find(&:retweet_count_filter?)
    token.retweet_count
  else
    DEFAULT_MINIMUM_RETWEET_COUNT
  end
end
query_string() click to toggle source

@return [String]

# File lib/ruboty/twitter_search/query.rb, line 33
def query_string
  tokens.reject(&:filter?).join(" ")
end
result_type() click to toggle source

@return [String, nil]

# File lib/ruboty/twitter_search/query.rb, line 38
def result_type
  if token = tokens.find(&:result_type_filter?)
    token.result_type
  end
end

Private Instance Methods

tokens() click to toggle source

@return [Array<Ruboty::Handlers::TwitterSearch::Token>]

# File lib/ruboty/twitter_search/query.rb, line 47
def tokens
  @tokens ||= @original_query_string.split.map do |token_string|
    Token.new(token_string)
  end
end