Class: CapsuleCRM::Collection

Inherits:
Array
  • Object
show all
Defined in:
lib/capsulecrm/collection.rb

Direct Known Subclasses

ChildCollection

Instance Method Summary collapse

Constructor Details

#initialize(klass, data) ⇒ Collection

nodoc



5
6
7
8
9
10
11
# File 'lib/capsulecrm/collection.rb', line 5

def initialize(klass, data)
  return if data.nil?
  [data].flatten.each do |attributes|
    attributes = klass.attributes_from_xml_hash(attributes)
    self.push klass.new(attributes)
  end
end