Bug #4401 » 0001-psych-visitors-yaml_tree.rb-use-public_method-instea.patch
ext/psych/lib/psych/visitors/yaml_tree.rb | ||
---|---|---|
end
|
||
if target.respond_to?(:to_yaml)
|
||
loc = target.method(:to_yaml).source_location.first
|
||
loc = target.public_method(:to_yaml).source_location.first
|
||
if loc !~ /(syck\/rubytypes.rb|psych\/core_ext.rb)/
|
||
unless target.respond_to?(:encode_with)
|
||
if $VERBOSE
|
||
... | ... | |
# FIXME: remove this method once "to_yaml_properties" is removed
|
||
def find_ivars target
|
||
loc = target.method(:to_yaml_properties).source_location.first
|
||
loc = target.public_method(:to_yaml_properties).source_location.first
|
||
unless loc.start_with?(Psych::DEPRECATED) || loc.end_with?('rubytypes.rb')
|
||
if $VERBOSE
|
||
warn "#{loc}: to_yaml_properties is deprecated, please implement \"encode_with(coder)\""
|
test/psych/visitors/test_yaml_tree.rb | ||
---|---|---|
assert_equal s.foo, obj.foo
|
||
end
|
||
def test_override_method
|
||
s = Struct.new(:method).new('override')
|
||
obj = Psych.load(Psych.dump(s))
|
||
assert_equal s.method, obj.method
|
||
end
|
||
def test_exception
|
||
ex = Exception.new 'foo'
|
||
loaded = Psych.load(Psych.dump(ex))
|