class Pry::SendTweet::TwitterSearch

Public Instance Methods

options(o) click to toggle source
# File lib/pry/send_tweet/commands/twitter_search.rb, line 11
def options(o)
  o.on 'c=', 'count=', "The number of tweets to show. Default is " \
                       "#{default_read_size}."
end
process(query) click to toggle source
Calls superclass method Pry::SendTweet::BaseCommand#process
# File lib/pry/send_tweet/commands/twitter_search.rb, line 16
def process(query)
  super
  tweets = filter twitter.search(query, search_options).to_a
  if tweets.empty?
    page "No results to show."
  else
    q = bright_blue(bold(query))
    render_tweets(tweets, title: format("Showing search results for %{q}", q: q))
  end
end

Private Instance Methods

filter(tweets) click to toggle source
# File lib/pry/send_tweet/commands/twitter_search.rb, line 27
        def filter(tweets)
  tweets.reject(&:retweet?)
end
search_options() click to toggle source
# File lib/pry/send_tweet/commands/twitter_search.rb, line 31
        def search_options
  {count: opts['count'] || default_read_size, tweet_mode: 'extended'}
end