Class: TwitterSearch::Trends
- Inherits:
-
Object
- Object
- TwitterSearch::Trends
- Includes:
- Enumerable
- Defined in:
- lib/trends.rb
Constant Summary collapse
- VARS =
[:date]
Instance Method Summary collapse
- #[](index) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(opts) ⇒ Trends
constructor
A new instance of Trends.
- #size ⇒ Object
Constructor Details
#initialize(opts) ⇒ Trends
Returns a new instance of Trends.
19 20 21 22 |
# File 'lib/trends.rb', line 19 def initialize(opts) @trends = opts['trends'].values.first.collect { |each| Trend.new(each) } VARS.each { |each| instance_variable_set "@#{each}", opts[each.to_s] } end |
Instance Method Details
#[](index) ⇒ Object
32 33 34 |
# File 'lib/trends.rb', line 32 def [](index) @trends[index] end |
#each(&block) ⇒ Object
24 25 26 |
# File 'lib/trends.rb', line 24 def each(&block) @trends.each(&block) end |
#size ⇒ Object
28 29 30 |
# File 'lib/trends.rb', line 28 def size @trends.size end |