Class: Twitter::Trendline

Inherits:
Object
  • Object
show all
Includes:
Comparable, Enumerable, ModelMixin
Defined in:
lib/twitter/model.rb

Overview

Represents a sorted, dated and typed list of trends.

To find out when this Trendline was created query the as_of attribute. To find out what type Trendline is use the type attribute. You can iterator over the trends in the Trendline with each or by index, whichever you prefer.

Constant Summary collapse

@@ATTRIBUTES =
[:as_of, :type]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ModelMixin

included

Class Method Details

.attributesObject



228
# File 'lib/twitter/model.rb', line 228

def attributes; @@ATTRIBUTES; end

Instance Method Details

#<=>(other) ⇒ Object

Spaceship operator definition needed by Comparable mixin for sort, etc.



233
234
235
# File 'lib/twitter/model.rb', line 233

def <=>(other)
  self.type === other.type && self.as_of <=> other.as_of
end

#[](index) ⇒ Object

index operator definition needed to iterate over trends in the ::Twitter::Trendline object using for or otherwise



246
247
248
# File 'lib/twitter/model.rb', line 246

def [](index)
  trends[index]
end

#eachObject

each definition needed by Enumerable mixin for first, ...



238
239
240
241
242
# File 'lib/twitter/model.rb', line 238

def each
  trends.each do |t|
    yield t
  end
end