Class: TweetAbout::TweetWords

Inherits:
Object
  • Object
show all
Defined in:
lib/tweetabout/tweet_words.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(username) ⇒ TweetWords

Returns a new instance of TweetWords.



7
8
9
# File 'lib/tweetabout/tweet_words.rb', line 7

def initialize(username)
  @username = username
end

Instance Attribute Details

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/tweetabout/tweet_words.rb', line 4

def status
  @status
end

#wordsObject

Returns the value of attribute words.



5
6
7
# File 'lib/tweetabout/tweet_words.rb', line 5

def words
  @words
end

Instance Method Details

#sort_words(options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/tweetabout/tweet_words.rb', line 11

def sort_words(options={})
  to_i = options[:tweets].to_i
  tweets_needed = to_i > 0? to_i : 200
  options[:tweets] = tweets_needed
  get_words
  if self.status == :ok
    words = self.words
    sorted_words = words.sort
    sorted_words = options[:with_count]? sorted_words : sorted_words.keys
    self.words = sorted_words
  end
  self
end