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_from(fragment) ⇒ Object
FIXME: redundant from Hash::Bindings.
- #serialize_for(value) ⇒ Object
Methods inherited from PropertyBinding
#initialize, #write, #write_scalar
Methods inherited from Hash::PropertyBinding
Methods inherited from Binding
#deserialize, #initialize, #serialize
Constructor Details
This class inherits a constructor from Representable::YAML::PropertyBinding
Instance Method Details
#deserialize_from(fragment) ⇒ Object
FIXME: redundant from Hash::Bindings
50 51 52 |
# File 'lib/representable/bindings/yaml_bindings.rb', line 50 def deserialize_from(fragment) # FIXME: redundant from Hash::Bindings fragment.collect { |item_fragment| deserialize(item_fragment) } end |
#serialize_for(value) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/representable/bindings/yaml_bindings.rb', line 43 def serialize_for(value) Psych::Nodes::Sequence.new.tap do |seq| seq.style = Psych::Nodes::Sequence::FLOW if definition.[:style] == :flow value.each { |obj| seq.children << super(obj) } end end |