method
init_with
v2_4_6 -
Show latest stable
- Class:
Psych::Visitors::ToRuby
init_with(o, h, node)private
No documentation available.
# File ext/psych/lib/psych/visitors/to_ruby.rb, line 377
def init_with o, h, node
c = Psych::Coder.new(node.tag)
c.map = h
if o.respond_to?(:init_with)
o.init_with c
elsif o.respond_to?(:yaml_initialize)
if $VERBOSE
warn "Implementing #{o.class}#yaml_initialize is deprecated, please implement \"init_with(coder)\""
end
o.yaml_initialize c.tag, c.map
else
h.each { |k,v| o.instance_variable_set(:"@#{k}", v) }
end
o
end