Sha256: 0f278aa84c7a8c9625b9f55f01b8cadaeae77d214b8f4136f3665e40f6e5c87c
Contents?: true
Size: 529 Bytes
Versions: 3
Compression:
Stored size: 529 Bytes
Contents
module Neo4j class Paginated include Enumerable attr_reader :items, :total, :current_page def initialize(items, total, current_page) @items, @total, @current_page = items, total, current_page end def self.create_from(source, page, per_page) #partial = source.drop((page-1) * per_page).first(per_page) partial = source.skip(page-1).limit(per_page) Paginated.new(partial, source.count, page) end delegate :each, :to => :items delegate :size, :[], :to => :items end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
neo4j-3.0.0.alpha.11 | lib/neo4j/paginated.rb |
neo4j-3.0.0.alpha.10 | lib/neo4j/paginated.rb |
neo4j-3.0.0.alpha.9 | lib/neo4j/paginated.rb |