Issue #13115 has been updated by tenderlovemaking (Aaron Patterson).

Status changed from Assigned to Closed

This has been fixed since Psych 3.0.0 https://github.com/ruby/psych/commit/712a65a53f3c15105cd86e8ad3ee3c779050ada4

----------------------------------------
Bug #13115: `YAML.dump` outputs deperecated message even with delegated object
https://bugs.ruby-lang.org/issues/13115#change-76161

* Author: mtsmfm (Fumiaki Matsushima)
* Status: Closed
* Priority: Normal
* Assignee: tenderlovemaking (Aaron Patterson)
* Target version: 
* ruby -v: ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
* Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
`YAML.dump` outputs deprecated message if it calls with delegated object
but doesn't with inherited object:

~~~ ruby
require 'yaml'
require 'delegate'

$VERBOSE = true
class Delegated < DelegateClass(Object)
  def initialize
    super(Object.new)
  end
end

puts 'YAML.dump(Delegated.new)'
YAML.dump(Delegated.new)

class Inherited < Object
end
puts 'YAML.dump(Inherited.new)'
YAML.dump(Inherited.new)

# $ ruby test.rb
# YAML.dump(Delegated.new)
# implementing to_yaml is deprecated, please implement "encode_with"
# YAML.dump(Inherited.new)
~~~

Is this intentional?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>