Class: Representable::XML::Binding::Attribute

Inherits:
Representable::XML::Binding show all
Defined in:
lib/representable/xml/binding.rb

Overview

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

Instance Attribute Summary

Attributes inherited from Binding

#array, #cached_representer, #getter, #has_default, #name, #representable, #represented, #setter, #skip_filters, #typed, #user_options

Instance Method Summary collapse

Methods inherited from Representable::XML::Binding

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

Methods inherited from Binding

#[], #as, build, #compile_fragment, #default_for, #evaluate_option, #get, #initialize, #parse_filter, #read_fragment, #render_filter, #render_fragment, #representer_module_for, #set, #skipable_empty_value?, #uncompile_fragment, #update!, #write_fragment

Methods included from Binding::Factories

#deserializer, #deserializer_class, #populator, #populator_class, #serializer, #serializer_class

Constructor Details

This class inherits a constructor from Representable::Binding

Instance Method Details

#read(node) ⇒ Object



142
143
144
# File 'lib/representable/xml/binding.rb', line 142

def read(node)
  node[as]
end

#serialize_for(value, parent) ⇒ Object



146
147
148
# File 'lib/representable/xml/binding.rb', line 146

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

#write(parent, value) ⇒ Object



150
151
152
# File 'lib/representable/xml/binding.rb', line 150

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