Sha256: 4088d46a40586b9d96012475be4929f4b842dda87912e6bb5e1e502180fdac18
Contents?: true
Size: 564 Bytes
Versions: 5
Compression:
Stored size: 564 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 :pluck, :to => :items delegate :size, :[], :to => :items end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
neo4j-3.0.2 | lib/neo4j/paginated.rb |
neo4j-3.0.1 | lib/neo4j/paginated.rb |
neo4j-3.0.0 | lib/neo4j/paginated.rb |
neo4j-3.0.0.rc.5 | lib/neo4j/paginated.rb |
neo4j-3.0.0.rc.4 | lib/neo4j/paginated.rb |