Skip to content

mediaslave24/pagez

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pagez

Micro pagination for ruby

Install

gem install pagez

Usage

require 'pagez'

# For objects with .slice method
array = (1..100).to_a

pagination = Pagez.new(array, per_page: 3)

pagination.to_page(20)

pagination.total #= 34
pagination.to_a #=> [58, 59, 60]
pagination.to_h #=> {:page=>20, :per_page=>3, :items=>[58, 59, 60], :total=>34}

# With ActiveRecord

scope = Users.all
pagination = Pagez.new(scope, per_page: 10)

# works same as for array
pagination.total
pagination.to_a
pagination.to_h

About

Micro pagination for ruby

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages