mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
38297f330b
commit
63578c725c
2 changed files with 12 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue