Class: Modulr::Resources::BaseCollection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/modulr/resources/base_collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, item_klass, attributes_collection = []) ⇒ BaseCollection

Returns a new instance of BaseCollection.



10
11
12
13
# File 'lib/modulr/resources/base_collection.rb', line 10

def initialize(response, item_klass, attributes_collection = [])
  @response = response
  @items = attributes_collection.map { |attributes| item_klass.new(nil, attributes) }
end

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



6
7
8
# File 'lib/modulr/resources/base_collection.rb', line 6

def response
  @response
end

Instance Method Details

#each(&block) ⇒ Object



15
16
17
# File 'lib/modulr/resources/base_collection.rb', line 15

def each(&block)
  @items.each(&block)
end