Class: Representable::XML::AttributeBinding

Inherits:
PropertyBinding show all
Defined in:
lib/representable/bindings/xml_bindings.rb

Overview

Represents a tag attribute. Currently this only works on the top-level tag.

Instance Attribute Summary

Attributes inherited from Binding

#represented, #user_options

Instance Method Summary collapse

Methods inherited from PropertyBinding

build_for, #deserialize_from, #deserialize_method, #serialize_method, #serialize_node

Methods included from Binding::Object

#create_object, #deserialize, #serialize

Methods inherited from Binding

#as, build, #compile_fragment, #get, #initialize, #read_fragment, #read_fragment_for, #representer_module_for, #set, #uncompile_fragment, #write_fragment, #write_fragment_for

Constructor Details

This class inherits a constructor from Representable::Binding

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Representable::Binding

Instance Method Details

#read(node) ⇒ Object



145
146
147
# File 'lib/representable/bindings/xml_bindings.rb', line 145

def read(node)
  deserialize(node[as])
end

#serialize_for(value, parent) ⇒ Object



149
150
151
# File 'lib/representable/bindings/xml_bindings.rb', line 149

def serialize_for(value, parent)
  parent[as] = serialize(value.to_s)
end

#write(parent, value) ⇒ Object



153
154
155
# File 'lib/representable/bindings/xml_bindings.rb', line 153

def write(parent, value)
  serialize_for(value, parent)
end