Sha256: 19c0afd43cd291eb46f85b3a4e786191e091329b89ec77cce210b1c9f9aa0b34
Contents?: true
Size: 918 Bytes
Versions: 7
Compression:
Stored size: 918 Bytes
Contents
=begin rdoc Videojuicer::Resource::Collection is an array extension returned by many common actions within the Videojuicer SDK. Any request that returns paginated data, or a subset of your query results, will return a Collection object containing the object subset, with some additional pagination data. =end module Videojuicer module Resource class Collection < ::Array attr_accessor :limit attr_accessor :offset attr_accessor :total def initialize(objects, total, offset, limit) clear objects.each {|o| self << o } self.total = total self.offset = offset self.limit = limit end def page_count return 1 if limit.nil? (total.to_f/limit.to_f).ceil end def page_number return 1 if limit.nil? (offset.to_f/limit.to_f).ceil end end end end
Version data entries
7 entries across 7 versions & 1 rubygems