Class: TwitterKotoba
- Inherits:
-
Object
- Object
- TwitterKotoba
- Defined in:
- lib/twitter_kotoba.rb
Instance Attribute Summary collapse
-
#latest_tweets ⇒ Object
readonly
Returns the value of attribute latest_tweets.
-
#rate_limit_exceeded ⇒ Object
readonly
Returns the value of attribute rate_limit_exceeded.
-
#sorted_words ⇒ Object
readonly
Returns the value of attribute sorted_words.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(user) ⇒ TwitterKotoba
constructor
A new instance of TwitterKotoba.
- #word_list ⇒ Object
Constructor Details
#initialize(user) ⇒ TwitterKotoba
Returns a new instance of TwitterKotoba.
10 11 12 13 14 15 |
# File 'lib/twitter_kotoba.rb', line 10 def initialize(user) @user = user @latest_tweets = [] @sorted_words = [] @rate_limit_exceeded = false end |
Instance Attribute Details
#latest_tweets ⇒ Object (readonly)
Returns the value of attribute latest_tweets.
6 7 8 |
# File 'lib/twitter_kotoba.rb', line 6 def latest_tweets @latest_tweets end |
#rate_limit_exceeded ⇒ Object (readonly)
Returns the value of attribute rate_limit_exceeded.
8 9 10 |
# File 'lib/twitter_kotoba.rb', line 8 def rate_limit_exceeded @rate_limit_exceeded end |
#sorted_words ⇒ Object (readonly)
Returns the value of attribute sorted_words.
7 8 9 |
# File 'lib/twitter_kotoba.rb', line 7 def sorted_words @sorted_words end |
#user ⇒ Object
Returns the value of attribute user.
5 6 7 |
# File 'lib/twitter_kotoba.rb', line 5 def user @user end |
Instance Method Details
#word_list ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/twitter_kotoba.rb', line 17 def word_list if update word_hash = sanitized_tweets @sorted_words = word_hash.sort_by{ |key,value| value } output_words elsif @rate_limit_exceeded puts "\nTwitter rate limit exceeded.\n" # Twitter's limit is 150 req/hr so... # you can only make 150/5 = 30 req/hr puts "You may only make 30 requests per hour.\n\n" end return nil end |