Class: PFS::Resources::Collection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/pfs/resources/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#responseObject (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