Class: Andeltsa::TwitterRequest
- Inherits:
-
Object
- Object
- Andeltsa::TwitterRequest
- Includes:
- Connection, Helper
- Defined in:
- lib/andeltsa.rb
Overview
Your code goes here…
Instance Attribute Summary collapse
-
#date ⇒ Object
Returns the value of attribute date.
-
#okay_words ⇒ Object
Returns the value of attribute okay_words.
-
#tweets_words ⇒ Object
Returns the value of attribute tweets_words.
-
#username ⇒ Object
Returns the value of attribute username.
-
#words_rank ⇒ Object
Returns the value of attribute words_rank.
Instance Method Summary collapse
- #count_words_in_tweet ⇒ Object
-
#initialize(username, date) ⇒ TwitterRequest
constructor
A new instance of TwitterRequest.
- #tweet_collect ⇒ Object
Methods included from Helper
display_ranking, exit_message, rank_words, remove_stop_words, sort_hash_descend, words_counter
Methods included from Connection
check_connection, tweets_request
Constructor Details
#initialize(username, date) ⇒ TwitterRequest
Returns a new instance of TwitterRequest.
13 14 15 16 17 18 19 |
# File 'lib/andeltsa.rb', line 13 def initialize(username, date) @username = username @date = date @tweets_words = tweet_collect @okay_words = Helper.remove_stop_words(tweets_words) @words_rank = Helper.rank_words(okay_words) end |
Instance Attribute Details
#date ⇒ Object
Returns the value of attribute date.
12 13 14 |
# File 'lib/andeltsa.rb', line 12 def date @date end |
#okay_words ⇒ Object
Returns the value of attribute okay_words.
12 13 14 |
# File 'lib/andeltsa.rb', line 12 def okay_words @okay_words end |
#tweets_words ⇒ Object
Returns the value of attribute tweets_words.
12 13 14 |
# File 'lib/andeltsa.rb', line 12 def tweets_words @tweets_words end |
#username ⇒ Object
Returns the value of attribute username.
12 13 14 |
# File 'lib/andeltsa.rb', line 12 def username @username end |
#words_rank ⇒ Object
Returns the value of attribute words_rank.
12 13 14 |
# File 'lib/andeltsa.rb', line 12 def words_rank @words_rank end |
Instance Method Details
#count_words_in_tweet ⇒ Object
31 32 33 |
# File 'lib/andeltsa.rb', line 31 def count_words_in_tweet Helper.words_counter end |
#tweet_collect ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/andeltsa.rb', line 21 def tweet_collect Connection.tweets_request(username, date) tweets_only = File.open("./tweets_only_#{username}.json", "r") tweets_words = [] tweets_only.each do |tweet| tweets_words << tweet end tweets_words.join(" ").split(/[^a-zA-Z]/) end |