Class: LHS::Pagination::Page

Inherits:
Base
  • Object
show all
Defined in:
lib/lhs/pagination/page.rb

Constant Summary collapse

DEFAULT_OFFSET =
1

Constants inherited from Base

Base::DEFAULT_LIMIT

Instance Attribute Summary

Attributes inherited from Base

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#first_page, #initialize, #last_page, #limit, #limit_value, #next?, #next_page, #offset, page_to_offset, #pages_left, #prev_page, #previous?, #total, #total_pages

Constructor Details

This class inherits a constructor from LHS::Pagination::Base

Class Method Details

.next_offset(current_page, _limit, step = 1) ⇒ Object



13
14
15
# File 'lib/lhs/pagination/page.rb', line 13

def self.next_offset(current_page, _limit, step = 1)
  current_page.to_i + step.to_i
end

Instance Method Details

#current_pageObject



5
6
7
# File 'lib/lhs/pagination/page.rb', line 5

def current_page
  offset
end

#next_offset(step = 1) ⇒ Object



9
10
11
# File 'lib/lhs/pagination/page.rb', line 9

def next_offset(step = 1)
  self.class.next_offset(current_page, limit, step)
end