Class: Ixtlan::DataMapper::Collection
- Inherits:
-
Object
- Object
- Ixtlan::DataMapper::Collection
- Defined in:
- lib/ixtlan/datamapper/collection.rb
Instance Method Summary collapse
- #data=(d) ⇒ Object
-
#initialize(data, offset = nil, count = nil) ⇒ Collection
constructor
A new instance of Collection.
- #to_s ⇒ Object
Constructor Details
#initialize(data, offset = nil, count = nil) ⇒ Collection
Returns a new instance of Collection.
11 12 13 14 15 16 17 |
# File 'lib/ixtlan/datamapper/collection.rb', line 11 def initialize( data, offset = nil, count = nil ) super() self.total_count = data.count self.offset = offset.to_i last = ( count ? count.to_i : self.total_count ) - 1 + self.offset self.data = data[ self.offset..last ] end |
Instance Method Details
#data=(d) ⇒ Object
19 20 21 |
# File 'lib/ixtlan/datamapper/collection.rb', line 19 def data=( d ) raise "not implemented" end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/ixtlan/datamapper/collection.rb', line 23 def to_s "#{self.class}[ offset=#{offset} total_count=#{total_count} ]" end |