Class: Ixtlan::DataMapper::Collection

Inherits:
Object
  • Object
show all
Defined in:
lib/ixtlan/datamapper/collection.rb

Instance Method Summary collapse

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_sObject



23
24
25
# File 'lib/ixtlan/datamapper/collection.rb', line 23

def to_s
  "#{self.class}[ offset=#{offset} total_count=#{total_count} ]"
end