Class: Firuta::Commands::Paginate
- Defined in:
- lib/firuta/commands/paginate.rb
Constant Summary collapse
- DEFAULT_PER_PAGE =
10- DEFAULT_PAGE =
0
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Firuta::Commands::Base
Instance Method Details
#apply_to(collection) ⇒ Object
9 10 11 12 13 |
# File 'lib/firuta/commands/paginate.rb', line 9 def apply_to(collection) collection .each_slice(@params.first[:page_size] || DEFAULT_PER_PAGE) .to_a[@params.first[:page] || DEFAULT_PAGE] end |