Class: Dhis2::Pager
- Inherits:
-
Object
- Object
- Dhis2::Pager
- Defined in:
- lib/dhis2/pager.rb
Instance Attribute Summary collapse
-
#next_page ⇒ Object
readonly
Returns the value of attribute next_page.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#page_count ⇒ Object
readonly
Returns the value of attribute page_count.
-
#page_size ⇒ Object
readonly
Returns the value of attribute page_size.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Pager
constructor
A new instance of Pager.
- #last_page? ⇒ Boolean
Constructor Details
#initialize(hash) ⇒ Pager
Returns a new instance of Pager.
7 8 9 10 11 12 13 |
# File 'lib/dhis2/pager.rb', line 7 def initialize(hash) @page = hash["page"] @page_count = hash["page_count"] || hash["pageCount"] @total = hash["total"] @next_page = hash["next_page"] || hash["nextPage"] @page_size = hash["page_size"] || hash["pageSize"] end |
Instance Attribute Details
#next_page ⇒ Object (readonly)
Returns the value of attribute next_page.
5 6 7 |
# File 'lib/dhis2/pager.rb', line 5 def next_page @next_page end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
5 6 7 |
# File 'lib/dhis2/pager.rb', line 5 def page @page end |
#page_count ⇒ Object (readonly)
Returns the value of attribute page_count.
5 6 7 |
# File 'lib/dhis2/pager.rb', line 5 def page_count @page_count end |
#page_size ⇒ Object (readonly)
Returns the value of attribute page_size.
5 6 7 |
# File 'lib/dhis2/pager.rb', line 5 def page_size @page_size end |
#total ⇒ Object (readonly)
Returns the value of attribute total.
5 6 7 |
# File 'lib/dhis2/pager.rb', line 5 def total @total end |
Instance Method Details
#last_page? ⇒ Boolean
15 16 17 |
# File 'lib/dhis2/pager.rb', line 15 def last_page? page * page_size >= total end |