Class: Twitter::Cursor
Instance Attribute Summary collapse
-
#collection ⇒ Object
readonly
Returns the value of attribute collection.
Attributes inherited from Base
Instance Method Summary collapse
- #first? ⇒ Boolean (also: #first)
-
#initialize(attrs, method, klass = nil) ⇒ Twitter::Cursor
constructor
Initializes a new Cursor object.
- #last? ⇒ Boolean (also: #last)
Methods inherited from Base
Constructor Details
#initialize(attrs, method, klass = nil) ⇒ Twitter::Cursor
Initializes a new Cursor object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/twitter/cursor.rb', line 17 def initialize(attrs, method, klass=nil) super(attrs) @collection = Array(attrs[method.to_s]).map do |item| if klass klass.new(item) else item end end singleton_class.class_eval do alias_method method.to_sym, :collection end end |
Instance Attribute Details
#collection ⇒ Object (readonly)
Returns the value of attribute collection.
6 7 8 |
# File 'lib/twitter/cursor.rb', line 6 def collection @collection end |
Instance Method Details
#first? ⇒ Boolean Also known as: first
32 33 34 |
# File 'lib/twitter/cursor.rb', line 32 def first? previous_cursor.zero? end |
#last? ⇒ Boolean Also known as: last
38 39 40 |
# File 'lib/twitter/cursor.rb', line 38 def last? next_cursor.zero? end |