Class: Pry::SendTweet::TwitterSearch

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/pry/send_tweet/commands/twitter_search.rb

Constant Summary

Constants included from TimeAgoInWords

TimeAgoInWords::VERSION

Instance Method Summary collapse

Methods inherited from BaseCommand

inherited

Methods included from PagingSupport

#page, #page_error, #page_ok

Methods included from UserRenderer

#render_user

Methods included from TweetRenderer

#render_tweets

Methods included from TimeAgoInWords

time_ago_in_words

Instance Method Details

#options(o) ⇒ Object



11
12
13
14
# 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) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# 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