Module: Gollum::Pagination

Included in:
Page, Wiki
Defined in:
lib/gollum/pagination.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/gollum/pagination.rb', line 3

def self.included(klass)
  klass.extend ClassMethods
  class << klass
    # Default Integer max count of items to return in git commands.
    attr_accessor :per_page
  end
  klass.per_page = 30
end

Instance Method Details

#log_pagination_options(options = {}) ⇒ Object

Fills in git-specific options for the log command using simple pagination options.

options - Hash of options:

page - Optional Integer page number (default: 1)
per_page - Optional Integer max count of items to return.
           Defaults to #per_class class method.

Returns Hash with :max_count and :skip keys.



57
58
59
# File 'lib/gollum/pagination.rb', line 57

def log_pagination_options(options = {})
  self.class.log_pagination_options(options)
end

#page_to_skip(page) ⇒ Object

Turns a page number into an offset number for the git skip option.

page - Integer page number.

Returns an Integer.



44
45
46
# File 'lib/gollum/pagination.rb', line 44

def page_to_skip(page)
  self.class.page_to_skip(page)
end