diff options
-rw-r--r-- | lib/psych/deprecated.rb | 6 | ||||
-rw-r--r-- | test/psych/test_deprecated.rb | 6 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/psych/deprecated.rb b/lib/psych/deprecated.rb index b306b85..1d401d9 100644 --- a/lib/psych/deprecated.rb +++ b/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 c2c8a97..6db7238 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 |