Module: Gollum::Pagination

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

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



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

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.



59
60
61
# File 'lib/gollum-lib/pagination.rb', line 59

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.



46
47
48
# File 'lib/gollum-lib/pagination.rb', line 46

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