class Representable::YAML::Binding
Public Class Methods
Source
# File lib/representable/yaml/binding.rb, line 6 def self.build_for(definition) return Collection.new(definition) if definition.array? new(definition) end
Public Instance Methods
Source
# File lib/representable/yaml/binding.rb, line 32 def deserialize_method :from_hash end
Source
# File lib/representable/yaml/binding.rb, line 18 def node_for(fragment) write_scalar(fragment) end
private
Source
# File lib/representable/yaml/binding.rb, line 28 def serialize_method :to_ast end
Source
# File lib/representable/yaml/binding.rb, line 12 def write(map, fragment, as) map.children << Psych::Nodes::Scalar.new(as) map.children << node_for(fragment) # FIXME: should be serialize. end
Source
# File lib/representable/yaml/binding.rb, line 22 def write_scalar(value) return value if typed? Psych::Nodes::Scalar.new(value.to_s) end