diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/lib/psych/core_ext.rb | 13 | ||||
-rw-r--r-- | ext/syck/lib/syck/tag.rb | 5 |
2 files changed, 17 insertions, 1 deletions
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) diff --git a/ext/syck/lib/syck/tag.rb b/ext/syck/lib/syck/tag.rb index bfb4dc714d..9c6de57953 100644 --- a/ext/syck/lib/syck/tag.rb +++ b/ext/syck/lib/syck/tag.rb @@ -56,7 +56,7 @@ class Module # Adds a taguri _tag_ to a class, used when dumping or loading the class # in YAML. See YAML::tag_class for detailed information on typing and # taguris. - def yaml_as( tag, sc = true ) + def syck_yaml_as( tag, sc = true ) verbose, $VERBOSE = $VERBOSE, nil class_eval <<-"END", __FILE__, __LINE__+1 attr_writer :taguri @@ -78,6 +78,9 @@ class Module ensure $VERBOSE = verbose end + remove_method :yaml_as rescue nil + alias :yaml_as :syck_yaml_as + # Transforms the subclass name into a name suitable for display # in a subclassed tag. def yaml_tag_class_name |