Class: Braque::Collection::LinkedArray
- Inherits:
-
Array
- Object
- Array
- Braque::Collection::LinkedArray
- Defined in:
- lib/braque/collection.rb
Instance Attribute Summary collapse
-
#next_link ⇒ Object
readonly
Returns the value of attribute next_link.
-
#previous_link ⇒ Object
readonly
Returns the value of attribute previous_link.
-
#total_count ⇒ Object
readonly
Returns the value of attribute total_count.
Instance Method Summary collapse
-
#initialize(response = [], klass) ⇒ LinkedArray
constructor
A new instance of LinkedArray.
Constructor Details
#initialize(response = [], klass) ⇒ LinkedArray
Returns a new instance of LinkedArray.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/braque/collection.rb', line 8 def initialize(response = [], klass) next_link = response._links.try(:next) previous_link = response._links.try(:prev) total_count = response.try(:total_count) retrieved_items = [] response.each do |item| retrieved_items << klass.new(item) end @retrieved_items, @next_link, @previous_link, @total_count = retrieved_items, next_link, previous_link, total_count super retrieved_items end |
Instance Attribute Details
#next_link ⇒ Object (readonly)
Returns the value of attribute next_link.
4 5 6 |
# File 'lib/braque/collection.rb', line 4 def next_link @next_link end |
#previous_link ⇒ Object (readonly)
Returns the value of attribute previous_link.
5 6 7 |
# File 'lib/braque/collection.rb', line 5 def previous_link @previous_link end |
#total_count ⇒ Object (readonly)
Returns the value of attribute total_count.
6 7 8 |
# File 'lib/braque/collection.rb', line 6 def total_count @total_count end |