From 63578c725c481abf246b1c1e5b4ddf2942cb5508 Mon Sep 17 00:00:00 2001 From: tenderlove Date: Sat, 24 Apr 2010 22:27:55 +0000 Subject: * ext/psych/lib/psych/deprecated.rb: adding deprecated tagurize method * test/psych/test_deprecated.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/psych/lib/psych/deprecated.rb | 6 ++++++ test/psych/test_deprecated.rb | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/ext/psych/lib/psych/deprecated.rb b/ext/psych/lib/psych/deprecated.rb index b306b85bce..1d401d920f 100644 --- a/ext/psych/lib/psych/deprecated.rb +++ b/ext/psych/lib/psych/deprecated.rb @@ -50,6 +50,12 @@ module Psych key = [domain, type_tag].join ':' @domain_types[key] = [key, block] end + + def self.tagurize thing + warn "#{caller[0]}: add_private_type is deprecated, use add_domain_type" if $VERBOSE + return thing unless String === thing + "tag:yaml.org,2002:#{thing}" + end end class Object diff --git a/test/psych/test_deprecated.rb b/test/psych/test_deprecated.rb index c2c8a972c3..6db7238b0c 100644 --- a/test/psych/test_deprecated.rb +++ b/test/psych/test_deprecated.rb @@ -181,5 +181,11 @@ module Psych assert_equal [["x-private:foo", "bar"]], types end + + def test_tagurize + assert_nil Psych.tagurize nil + assert_equal Psych, Psych.tagurize(Psych) + assert_equal 'tag:yaml.org,2002:foo', Psych.tagurize('foo') + end end end -- cgit v1.2.3