Class: EngagingNetworks::Response::Collection

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/engaging_networks/response/collection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Collection

Returns a new instance of Collection.



10
11
12
13
14
# File 'lib/engaging_networks/response/collection.rb', line 10

def initialize(data)
  @objects = data.inject([]) do |arr, row|
    arr << EngagingNetworks::Response::Object.new(row)
  end
end

Instance Attribute Details

#objectsObject (readonly)

Returns the value of attribute objects.



8
9
10
# File 'lib/engaging_networks/response/collection.rb', line 8

def objects
  @objects
end

Instance Method Details

#each(&block) ⇒ Object



16
17
18
19
20
# File 'lib/engaging_networks/response/collection.rb', line 16

def each(&block)
  @objects.each do |o|
    block.call(o)
  end
end