Class: Munson::Paginator::PagedPaginator
- Inherits:
-
Object
- Object
- Munson::Paginator::PagedPaginator
- Defined in:
- lib/munson/paginator/paged_paginator.rb
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ PagedPaginator
constructor
A new instance of PagedPaginator.
- #set(opts = {}) ⇒ Object
- #to_params ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ PagedPaginator
4 5 6 7 |
# File 'lib/munson/paginator/paged_paginator.rb', line 4 def initialize(={}) @max_size = [:max] @default_size = [:default] end |
Instance Method Details
#set(opts = {}) ⇒ Object
9 10 11 12 |
# File 'lib/munson/paginator/paged_paginator.rb', line 9 def set(opts={}) number(opts[:number]) if opts[:number] size(opts[:size]) if opts[:size] end |
#to_params ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/munson/paginator/paged_paginator.rb', line 14 def to_params { page: { size: @size || @default_size || 10, number: @number }.select { |_, value| !value.nil? } } end |