class Representable::YAML::Binding
Public Class Methods
build_for(definition, *args)
click to toggle source
# File lib/representable/yaml/binding.rb, line 6 def self.build_for(definition, *args) return Collection.new(definition, *args) if definition.array? new(definition, *args) end
Public Instance Methods
deserialize_method()
click to toggle source
# File lib/representable/yaml/binding.rb, line 31 def deserialize_method :from_hash end
node_for(fragment)
click to toggle source
private
# File lib/representable/yaml/binding.rb, line 17 def node_for(fragment) write_scalar(fragment) end
serialize_method()
click to toggle source
# File lib/representable/yaml/binding.rb, line 27 def serialize_method :to_ast end
write(map, fragment)
click to toggle source
# File lib/representable/yaml/binding.rb, line 11 def write(map, fragment) map.children << Psych::Nodes::Scalar.new(as) map.children << node_for(fragment) # FIXME: should be serialize. end
write_scalar(value)
click to toggle source
# File lib/representable/yaml/binding.rb, line 21 def write_scalar(value) return value if typed? Psych::Nodes::Scalar.new(value.to_s) end