class Couchbase::ViewHelpers::PaginateParams

Constants

PER_PAGE_DEFAULT

Public Class Methods

new(params = {}) click to toggle source
# File lib/couchbase/view_helpers/paginate_params.rb, line 8
def initialize(params = {})
  @page     = (params[:page]     || 1).to_i
  @per_page = (params[:per_page] || PER_PAGE_DEFAULT).to_i
end

Public Instance Methods

to_h() click to toggle source
# File lib/couchbase/view_helpers/paginate_params.rb, line 13
def to_h
  {
    skip: (@page - 1) * @per_page,
    limit: @per_page
  }
end