ruby-changes:15576
From: tenderlove <ko1@a...>
Date: Sun, 25 Apr 2010 07:30:18 +0900 (JST)
Subject: [ruby-changes:15576] Ruby:r27482 (trunk): * ext/psych/lib/psych/deprecated.rb: adding deprecated tagurize method
tenderlove 2010-04-25 07:27:55 +0900 (Sun, 25 Apr 2010) New Revision: 27482 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27482 Log: * ext/psych/lib/psych/deprecated.rb: adding deprecated tagurize method * test/psych/test_deprecated.rb: ditto Modified files: trunk/ext/psych/lib/psych/deprecated.rb trunk/test/psych/test_deprecated.rb Index: ext/psych/lib/psych/deprecated.rb =================================================================== --- ext/psych/lib/psych/deprecated.rb (revision 27481) +++ ext/psych/lib/psych/deprecated.rb (revision 27482) @@ -50,6 +50,12 @@ 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 Index: test/psych/test_deprecated.rb =================================================================== --- test/psych/test_deprecated.rb (revision 27481) +++ test/psych/test_deprecated.rb (revision 27482) @@ -181,5 +181,11 @@ 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/