Class: TwitterHashtag::Formatter
- Inherits:
-
Object
- Object
- TwitterHashtag::Formatter
- Defined in:
- lib/twitter_hashtag/formatter.rb
Instance Attribute Summary collapse
-
#results ⇒ Object
readonly
Returns the value of attribute results.
Instance Method Summary collapse
- #format ⇒ Object
-
#initialize(response) ⇒ Formatter
constructor
A new instance of Formatter.
Constructor Details
#initialize(response) ⇒ Formatter
Returns a new instance of Formatter.
6 7 8 |
# File 'lib/twitter_hashtag/formatter.rb', line 6 def initialize(response) @results = response['results'] end |
Instance Attribute Details
#results ⇒ Object (readonly)
Returns the value of attribute results.
10 11 12 |
# File 'lib/twitter_hashtag/formatter.rb', line 10 def results @results end |
Instance Method Details
#format ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/twitter_hashtag/formatter.rb', line 12 def format if results.empty? puts 'None found.' exit 1 else puts 'Results:' TwitterHashtag::Tweet.output(results) end end |