Class: Page
- Inherits:
-
Object
- Object
- Page
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/restpack_activity/models/page.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(response, key) ⇒ Page
constructor
A new instance of Page.
- #next_page ⇒ Object
- #next_page? ⇒ Boolean
- #page ⇒ Object
- #page_count ⇒ Object
- #page_size ⇒ Object
- #previous_page ⇒ Object
- #previous_page? ⇒ Boolean
Constructor Details
#initialize(response, key) ⇒ Page
Returns a new instance of Page.
11 12 13 14 15 16 17 18 19 |
# File 'lib/restpack_activity/models/page.rb', line 11 def initialize(response, key) @response = response @key = key @items = [] response.result[key].each do |item| @items << yield(item) end end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
9 10 11 |
# File 'lib/restpack_activity/models/page.rb', line 9 def items @items end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
9 10 11 |
# File 'lib/restpack_activity/models/page.rb', line 9 def response @response end |
Instance Method Details
#count ⇒ Object
21 22 23 |
# File 'lib/restpack_activity/models/page.rb', line 21 def count :count end |
#next_page ⇒ Object
41 42 43 |
# File 'lib/restpack_activity/models/page.rb', line 41 def next_page :next_page end |
#next_page? ⇒ Boolean
49 50 51 |
# File 'lib/restpack_activity/models/page.rb', line 49 def next_page? next_page != nil end |
#page ⇒ Object
25 26 27 |
# File 'lib/restpack_activity/models/page.rb', line 25 def page :page end |
#page_count ⇒ Object
33 34 35 |
# File 'lib/restpack_activity/models/page.rb', line 33 def page_count :page_count end |
#page_size ⇒ Object
29 30 31 |
# File 'lib/restpack_activity/models/page.rb', line 29 def page_size :page_size end |
#previous_page ⇒ Object
37 38 39 |
# File 'lib/restpack_activity/models/page.rb', line 37 def previous_page :previous_page end |
#previous_page? ⇒ Boolean
45 46 47 |
# File 'lib/restpack_activity/models/page.rb', line 45 def previous_page? previous_page != nil end |