Module: Folio::Page
Instance Attribute Summary collapse
-
#current_page ⇒ Object
page identifier addressing this page within the folio.
-
#first_page ⇒ Object
page identifier addressing the first page within the folio.
-
#next_page ⇒ Object
page identifier addressing the immediately following page within the folio, if there is one.
-
#ordinal_pages ⇒ Object
(also: #ordinal_pages?)
indicates whether the page identifiers in current_page, first_page, last_page, previous_page, and next_page should be considered ordinal or not.
-
#previous_page ⇒ Object
page identifier addressing the immediately preceding page within the folio, if there is one and it is known.
-
#total_entries ⇒ Object
number of items in the folio, if known.
Class Method Summary collapse
Instance Method Summary collapse
- #last_page ⇒ Object
-
#last_page=(value) ⇒ Object
page identifier addressing the final page within the folio, if known.
-
#total_pages ⇒ Object
number of pages in the folio, if known.
Methods included from PerPage
Instance Attribute Details
#current_page ⇒ Object
page identifier addressing this page within the folio.
26 27 28 |
# File 'lib/folio/page.rb', line 26 def current_page @current_page end |
#first_page ⇒ Object
page identifier addressing the first page within the folio.
32 33 34 |
# File 'lib/folio/page.rb', line 32 def first_page @first_page end |
#next_page ⇒ Object
page identifier addressing the immediately following page within the folio, if there is one.
50 51 52 |
# File 'lib/folio/page.rb', line 50 def next_page @next_page end |
#ordinal_pages ⇒ Object Also known as: ordinal_pages?
indicates whether the page identifiers in current_page, first_page, last_page, previous_page, and next_page should be considered ordinal or not.
22 23 24 |
# File 'lib/folio/page.rb', line 22 def ordinal_pages @ordinal_pages end |
#previous_page ⇒ Object
page identifier addressing the immediately preceding page within the folio, if there is one and it is known.
54 55 56 |
# File 'lib/folio/page.rb', line 54 def previous_page @previous_page end |
#total_entries ⇒ Object
number of items in the folio, if known.
57 58 59 |
# File 'lib/folio/page.rb', line 57 def total_entries @total_entries end |
Class Method Details
Instance Method Details
#last_page ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/folio/page.rb', line 40 def last_page if next_page.nil? current_page else @last_page end end |
#last_page=(value) ⇒ Object
page identifier addressing the final page within the folio, if known.
36 37 38 |
# File 'lib/folio/page.rb', line 36 def last_page=(value) @last_page = value end |
#total_pages ⇒ Object
number of pages in the folio, if known. calculated from total_entries and per_page.
61 62 63 64 65 |
# File 'lib/folio/page.rb', line 61 def total_pages return nil unless total_entries && per_page && per_page > 0 return 1 if total_entries <= 0 (total_entries / per_page.to_f).ceil end |