diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2010-04-24 15:28:24 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2010-04-24 15:28:24 -0700 |
commit | 88bcb83729ebea6a7d4581b3100dfa7a783a9ff7 (patch) | |
tree | 1cb9c46264427527c312ae8bb1086f48f87acfff | |
parent | c69c270f19f40e6e7e12905bfeaa03ce977b7ec2 (diff) | |
download | psych-88bcb83729ebea6a7d4581b3100dfa7a783a9ff7.zip |
adding deprecated method "tagurize"
-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 |