Class: PFS::Resources::Collection
- Inherits:
-
Object
- Object
- PFS::Resources::Collection
- Includes:
- Enumerable
- Defined in:
- lib/pfs/resources/collection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(response, item_klass, attributes_collection = []) ⇒ Collection
constructor
A new instance of Collection.
Constructor Details
#initialize(response, item_klass, attributes_collection = []) ⇒ Collection
Returns a new instance of Collection.
9 10 11 12 13 |
# File 'lib/pfs/resources/collection.rb', line 9 def initialize(response, item_klass, attributes_collection = []) @response = response @attributes_collection = attributes_collection @items = attributes_collection.map { |attributes_item| item_klass.new(nil, attributes_item) } end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/pfs/resources/collection.rb', line 7 def response @response end |
Instance Method Details
#each(&block) ⇒ Object
15 16 17 |
# File 'lib/pfs/resources/collection.rb', line 15 def each(&block) @items.each(&block) end |