Class: Twitter::Cursor
Instance Attribute Summary (collapse)
-
- (Object) collection
readonly
Returns the value of attribute collection.
Attributes inherited from Base
Instance Method Summary (collapse)
- - (Boolean) first? (also: #first)
-
- (Twitter::Cursor) initialize(attrs, method, klass = nil)
constructor
Initializes a new Cursor object.
- - (Boolean) last? (also: #last)
Methods inherited from Base
Constructor Details
- (Twitter::Cursor) initialize(attrs, method, klass = nil)
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
- (Object) collection (readonly)
Returns the value of attribute collection
6 7 8 |
# File 'lib/twitter/cursor.rb', line 6 def collection @collection end |
Instance Method Details
- (Boolean) first? Also known as: first
32 33 34 |
# File 'lib/twitter/cursor.rb', line 32 def first? previous_cursor.zero? end |
- (Boolean) last? Also known as: last
38 39 40 |
# File 'lib/twitter/cursor.rb', line 38 def last? next_cursor.zero? end |