Module: Representable::XML

Defined in:
lib/representable/xml.rb,
lib/representable/bindings/xml_bindings.rb

Defined Under Namespace

Modules: ClassMethods, InstanceMethods Classes: AttributeBinding, Binding, Definition, NamespaceBinding, ObjectBinding, TextBinding

Constant Summary collapse

BINDING_FOR_TYPE =
{
  :attr     => AttributeBinding,
  :text     => TextBinding,
  :namespace=> NamespaceBinding,
}

Class Method Summary collapse

Class Method Details

.binding_for_definition(definition) ⇒ Object



12
13
14
# File 'lib/representable/xml.rb', line 12

def self.binding_for_definition(definition)
  (BINDING_FOR_TYPE[definition.sought_type] or ObjectBinding).new(definition)
end

.included(base) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/representable/xml.rb', line 16

def self.included(base)
  base.class_eval do
    include Representable
    include InstanceMethods
    extend ClassMethods
  end
end