Sha256: cb0d2d71da118e64a5b31293590e9a67a68b64b094828dce4be00d0d40141268
Contents?: true
Size: 704 Bytes
Versions: 1
Compression:
Stored size: 704 Bytes
Contents
require 'virtus' module Ixtlan module DataMapper class Collection include Virtus.model( #:mass_assignments => false, :coerce => false ) attribute :offset, Integer attribute :total_count, Integer 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 def data=( d ) raise "not implemented" end def to_s "#{self.class}[ offset=#{offset} total_count=#{total_count} ]" end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ixtlan-datamapper-0.1.0 | lib/ixtlan/datamapper/collection.rb |