Class: Zipmark::Pagination
- Inherits:
-
Object
- Object
- Zipmark::Pagination
- Defined in:
- lib/zipmark/pagination.rb
Instance Attribute Summary collapse
-
#pagination_hash ⇒ Object
Returns the value of attribute pagination_hash.
Instance Method Summary collapse
- #current_page ⇒ Object
- #first_page? ⇒ Boolean
-
#initialize(hash) ⇒ Pagination
constructor
A new instance of Pagination.
- #last_page? ⇒ Boolean
- #pages ⇒ Object
- #per_page ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(hash) ⇒ Pagination
Returns a new instance of Pagination.
5 6 7 8 |
# File 'lib/zipmark/pagination.rb', line 5 def initialize(hash) raise ArgumentError, "expected hash" unless hash && hash.kind_of?(Hash) @pagination_hash = hash end |
Instance Attribute Details
#pagination_hash ⇒ Object
Returns the value of attribute pagination_hash.
3 4 5 |
# File 'lib/zipmark/pagination.rb', line 3 def pagination_hash @pagination_hash end |
Instance Method Details
#current_page ⇒ Object
22 23 24 |
# File 'lib/zipmark/pagination.rb', line 22 def current_page pagination_hash["page"] end |
#first_page? ⇒ Boolean
26 27 28 |
# File 'lib/zipmark/pagination.rb', line 26 def first_page? pagination_hash["first_page"] end |
#last_page? ⇒ Boolean
30 31 32 |
# File 'lib/zipmark/pagination.rb', line 30 def last_page? pagination_hash["last_page"] end |
#pages ⇒ Object
10 11 12 |
# File 'lib/zipmark/pagination.rb', line 10 def pages pagination_hash["total_pages"] end |
#per_page ⇒ Object
18 19 20 |
# File 'lib/zipmark/pagination.rb', line 18 def per_page pagination_hash["per_page"] end |
#total ⇒ Object
14 15 16 |
# File 'lib/zipmark/pagination.rb', line 14 def total pagination_hash["total"] end |