Class: Makura::Plugin::Pager::Pagination
- Inherits:
-
Object
- Object
- Makura::Plugin::Pager::Pagination
- Includes:
- Enumerable
- Defined in:
- lib/makura/plugin/pager.rb
Instance Method Summary collapse
- #count ⇒ Object
- #each(start_id = nil, descending = false, &block) ⇒ Object
- #empty? ⇒ Boolean
- #first_page? ⇒ Boolean
-
#initialize(model, view, page, limit) ⇒ Pagination
constructor
A new instance of Pagination.
- #last_page? ⇒ Boolean
Constructor Details
#initialize(model, view, page, limit) ⇒ Pagination
Returns a new instance of Pagination.
11 12 13 |
# File 'lib/makura/plugin/pager.rb', line 11 def initialize(model, view, page, limit) @model, @view, @page, @limit = model, view, page, limit end |
Instance Method Details
#count ⇒ Object
42 43 |
# File 'lib/makura/plugin/pager.rb', line 42 def count end |
#each(start_id = nil, descending = false, &block) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/makura/plugin/pager.rb', line 25 def each(start_id = nil, descending = false, &block) opts = { :count => @limit, :group => true, :descending => descending, # :include_docs => true, } if start_id opts[:skip] = 1 opts[:startkey_docid] = start_id opts[:startkey] = start_id end @model.view(@view, opts).each(&block) end |
#empty? ⇒ Boolean
51 52 |
# File 'lib/makura/plugin/pager.rb', line 51 def empty? end |
#first_page? ⇒ Boolean
45 46 |
# File 'lib/makura/plugin/pager.rb', line 45 def first_page? end |
#last_page? ⇒ Boolean
48 49 |
# File 'lib/makura/plugin/pager.rb', line 48 def last_page? end |