Class: Representable::YAML::CollectionBinding
- Inherits:
-
PropertyBinding
- Object
- Binding
- Hash::PropertyBinding
- PropertyBinding
- Representable::YAML::CollectionBinding
- Defined in:
- lib/representable/bindings/yaml_bindings.rb
Instance Attribute Summary
Attributes inherited from Binding
Instance Method Summary collapse
-
#deserialize(fragment) ⇒ Object
FIXME: redundant from Hash::Bindings.
- #serialize(value) ⇒ Object
Methods inherited from PropertyBinding
build_for, #deserialize_method, #serialize_method, #write, #write_scalar
Methods inherited from Hash::PropertyBinding
build_for, #deserialize_from, #deserialize_method, #read, #serialize_method, #write
Methods included from Binding::Object
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
#deserialize(fragment) ⇒ Object
FIXME: redundant from Hash::Bindings
44 45 46 |
# File 'lib/representable/bindings/yaml_bindings.rb', line 44 def deserialize(fragment) # FIXME: redundant from Hash::Bindings CollectionDeserializer.new(self).deserialize(fragment) end |
#serialize(value) ⇒ Object
37 38 39 40 41 42 |
# File 'lib/representable/bindings/yaml_bindings.rb', line 37 def serialize(value) Psych::Nodes::Sequence.new.tap do |seq| seq.style = Psych::Nodes::Sequence::FLOW if self[:style] == :flow value.each { |obj| seq.children << super(obj) } end end |