Class: Trendy::Trends
- Inherits:
-
Array
- Object
- Array
- Trendy::Trends
- Defined in:
- lib/trendy.rb
Overview
Trends is an array which contains Trend objects use these Trend objects to access information about a particular trend
Instance Attribute Summary collapse
-
#datetime ⇒ Object
readonly
Returns the value of attribute datetime.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize ⇒ Trends
constructor
A new instance of Trends.
Constructor Details
#initialize ⇒ Trends
Returns a new instance of Trends.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/trendy.rb', line 13 def initialize @url = 'http://search.twitter.com/trends.json' result = read_twitter trends = result['trends'] @datetime = result['as_of'] trends.each do |subject| trend = Trend.new trend.name = subject['name'] trend.url = subject['url'] self.push(trend) end end |
Instance Attribute Details
#datetime ⇒ Object (readonly)
Returns the value of attribute datetime.
11 12 13 |
# File 'lib/trendy.rb', line 11 def datetime @datetime end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/trendy.rb', line 11 def url @url end |