diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-24 04:11:27 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-24 04:11:27 +0000 |
commit | 7309f9cc007f1cc05eb70967356069161d867356 (patch) | |
tree | 6dcfc346ff9055c7d938b8f01be917c6ed1edd98 /ext/psych/lib/psych.rb | |
parent | 655b2ade4984f8d0ad6c76d6eff35262ad7d2619 (diff) |
* ext/psych/lib/psych.rb: supporting deprecated syck method
add_ruby_type
* ext/psych/lib/psych/visitors/to_ruby.rb: ditto
* test/psych/test_deprecated.rb: ditto
* test/psych/test_psych.rb: ditto
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27469 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/psych/lib/psych.rb')
-rw-r--r-- | ext/psych/lib/psych.rb | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/psych/lib/psych.rb b/ext/psych/lib/psych.rb index 58c77f40fd..16602ef221 100644 --- a/ext/psych/lib/psych.rb +++ b/ext/psych/lib/psych.rb @@ -207,11 +207,22 @@ module Psych # :stopdoc: @domain_types = {} def self.add_domain_type domain, type_tag, &block - @domain_types[type_tag] = ["http://#{domain}", block] + key = ['tag', domain, type_tag].join ':' + @domain_types[key] = [key, block] + @domain_types["tag:#{type_tag}"] = [key, block] end def self.add_builtin_type type_tag, &block - @domain_types[type_tag] = ['yaml.org', block] + domain = 'yaml.org,2002' + key = ['tag', domain, type_tag].join ':' + @domain_types[key] = [key, block] + end + + def self.add_ruby_type type_tag, &block + warn "#{caller[0]}: add_ruby_type is deprecated, use add_domain_type" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) + domain = 'ruby.yaml.org,2002' + key = ['tag', domain, type_tag].join ':' + @domain_types[key] = [key, block] end def self.remove_type type_tag |