Module: Lycra::Search::Pagination
- Defined in:
- lib/lycra/search/pagination.rb
Class Method Summary collapse
Instance Method Summary collapse
- #limit(lmt = nil) ⇒ Object
- #offset(ofst = nil) ⇒ Object
- #page(pg = nil) ⇒ Object
- #per(pr = nil) ⇒ Object
Class Method Details
.included(base) ⇒ Object
4 5 6 7 8 |
# File 'lib/lycra/search/pagination.rb', line 4 def self.included(base) base.send :delegate, :total_pages, :current_page, :limit_value, :offset_value, :first_page?, :last_page?, to: :response base.send :alias_method, :pages, :total_pages end |
Instance Method Details
#limit(lmt = nil) ⇒ Object
25 26 27 28 |
# File 'lib/lycra/search/pagination.rb', line 25 def limit(lmt=nil) @response = response.limit(lmt || Lycra.configuration.per_page) self end |
#offset(ofst = nil) ⇒ Object
20 21 22 23 |
# File 'lib/lycra/search/pagination.rb', line 20 def offset(ofst=nil) @response = response.offset(ofst || 0) self end |
#page(pg = nil) ⇒ Object
10 11 12 13 |
# File 'lib/lycra/search/pagination.rb', line 10 def page(pg=nil) @response = response.page(pg || 1) self end |
#per(pr = nil) ⇒ Object
15 16 17 18 |
# File 'lib/lycra/search/pagination.rb', line 15 def per(pr=nil) @response = response.per(pr || Lycra.configuration.per_page) self end |