From 5b5bbdbb35098e8e2dabe7af5d31526a54dc8bbd Mon Sep 17 00:00:00 2001 From: tenderlove Date: Fri, 16 Apr 2010 20:31:59 +0000 Subject: * ext/psych/lib/psych/core_ext.rb (yaml_as): supporting deprecated "yaml_as" method * ext/syck/lib/syck/tag.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/core_ext.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'ext/psych/lib') diff --git a/ext/psych/lib/psych/core_ext.rb b/ext/psych/lib/psych/core_ext.rb index 9c55c707a1..8d3e8fb7b6 100644 --- a/ext/psych/lib/psych/core_ext.rb +++ b/ext/psych/lib/psych/core_ext.rb @@ -16,6 +16,19 @@ class Object alias :to_yaml :psych_to_yaml end +class Module + def psych_yaml_as url + return if caller[0].end_with?('rubytypes.rb') + if $VERBOSE + warn "#{caller[0]}: yaml_as is deprecated, please use yaml_tag" + end + Psych.add_tag(url, self) + end + + remove_method :yaml_as rescue nil + alias :yaml_as :psych_yaml_as +end + module Kernel def psych_y *objects puts Psych.dump_stream(*objects) -- cgit v1.2.3