Class: TwitterSearch::Trends

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/trends.rb

Constant Summary collapse

VARS =
[:date]

Instance Method Summary collapse

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

#sizeObject



28
29
30
# File 'lib/trends.rb', line 28

def size
  @trends.size
end