Class: Makura::Plugin::Pager::Pagination

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/makura/plugin/pager.rb

Instance Method Summary collapse

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

#countObject



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

Returns:

  • (Boolean)


51
52
# File 'lib/makura/plugin/pager.rb', line 51

def empty?
end

#first_page?Boolean

Returns:

  • (Boolean)


45
46
# File 'lib/makura/plugin/pager.rb', line 45

def first_page?
end

#last_page?Boolean

Returns:

  • (Boolean)


48
49
# File 'lib/makura/plugin/pager.rb', line 48

def last_page?
end