Method: Representable::XML::Binding.build_for

Defined in:
lib/representable/xml/binding.rb

.build_for(definition, *args) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/representable/xml/binding.rb', line 7

def self.build_for(definition, *args)
  return Collection.new(definition, *args)      if definition.array?
  return Hash.new(definition, *args)            if definition.hash? and not definition[:use_attributes] # FIXME: hate this.
  return AttributeHash.new(definition, *args)   if definition.hash? and definition[:use_attributes]
  return Attribute.new(definition, *args)       if definition[:attribute]
  return Content.new(definition, *args)         if definition[:content]
  new(definition, *args)
end