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, #parse_filter, #read_fragment, #read_fragment_for, #render_filter, #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



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

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

#serialize_for(value, parent) ⇒ Object



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

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

#write(parent, value) ⇒ Object



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

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