Class: Pry::SendTweet::ReadTweets
- Inherits:
-
BaseCommand
- Object
- ClassCommand
- BaseCommand
- Pry::SendTweet::ReadTweets
- Includes:
- TranslateActions
- Defined in:
- lib/pry/send_tweet/commands/read_tweets.rb
Defined Under Namespace
Modules: TranslateActions
Constant Summary
Constants included from TranslateActions
TranslateActions::LANGUAGE_STRINGS, TranslateActions::YANDEX_ENDPOINT
Constants included from TimeAgoInWords
Instance Method Summary collapse
Methods included from TranslateActions
#translate_text, #translate_tweet
Methods inherited from BaseCommand
Methods included from PagingSupport
Methods included from UserRenderer
Methods included from TweetRenderer
Methods included from TimeAgoInWords
Instance Method Details
#options(o) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/pry/send_tweet/commands/read_tweets.rb', line 13 def (o) o.on 't=', 'tweeter=', 'A username whose timeline you want to read.' o.on 'c=', 'count=', "The number of tweets to read. The maximum is 200, and the default is " \ "#{default_read_size}." o.on 'l=', 'likes=', 'Read tweets you or another user have liked.', argument: :optional o.on 'r=', 'replies=', 'A username whose replies you want to read.' o.on 'm', 'mentions', 'Read tweets that @mention you.' o.on 'x=', 'translate=', 'Translate a tweet.' o.on 'tx=', nil, 'Translate a string of text.' o.on 'sl=', 'source-lang=', '[optional] The source language of the ' \ 'text or tweet being translated' o.on 'w', 'with-retweets', 'Include retweets.' end |
#process ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pry/send_tweet/commands/read_tweets.rb', line 31 def process super case when opts.present?('translate') then translate_tweet(opts['x'], opts['sl']) when opts.present?('tx') then translate_text(opts['tx'], opts['sl']) when opts.present?('replies') then show_replies(user: opts['replies']) when opts.present?('likes') then show_likes(user: opts['likes']) when opts.present?('mentions') then show_mentions else show_tweets_from_timeline(user: opts['tweeter']) end end |