module Gollum::Pagination

Public Class Methods

included(klass) click to toggle source
# 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

Public Instance Methods

log_pagination_options(options = {}) click to toggle source

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.

# File lib/gollum-lib/pagination.rb, line 58
def log_pagination_options(options = {})
  self.class.log_pagination_options(options)
end
page_to_skip(page) click to toggle source

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

page - Integer page number.

Returns an Integer.

# File lib/gollum-lib/pagination.rb, line 45
def page_to_skip(page)
  self.class.page_to_skip(page)
end