ruby-changes:15333
From: naruse <ko1@a...>
Date: Mon, 5 Apr 2010 13:13:00 +0900 (JST)
Subject: [ruby-changes:15333] Ruby:r27221 (trunk): * ext/psych/lib/psych/core_ext.rb: remove before alias.
naruse 2010-04-05 13:12:14 +0900 (Mon, 05 Apr 2010) New Revision: 27221 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27221 Log: * ext/psych/lib/psych/core_ext.rb: remove before alias. * ext/syck/lib/syck.rb: don't warn called by itself. Modified files: trunk/ChangeLog trunk/ext/psych/lib/psych/core_ext.rb trunk/ext/syck/lib/syck.rb trunk/test/rubygems/gemutilities.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 27220) +++ ChangeLog (revision 27221) @@ -1,3 +1,9 @@ +Mon Apr 5 13:10:35 2010 NARUSE, Yui <naruse@r...> + + * ext/psych/lib/psych/core_ext.rb: remove before alias. + + * ext/syck/lib/syck.rb: don't warn called by itself. + Mon Apr 5 13:08:24 2010 NAKAMURA Usaku <usa@r...> * win32/mkexports.rb (each_export): VC10 support. Index: ext/psych/lib/psych/core_ext.rb =================================================================== --- ext/psych/lib/psych/core_ext.rb (revision 27220) +++ ext/psych/lib/psych/core_ext.rb (revision 27221) @@ -12,11 +12,14 @@ def psych_to_yaml options = {} Psych.dump self, options end + remove_method :to_yaml rescue nil alias :to_yaml :psych_to_yaml end module Kernel - def y *objects + def psych_y *objects puts Psych.dump_stream(*objects) end + remove_method :y rescue nil + alias y psych_y end Index: ext/syck/lib/syck.rb =================================================================== --- ext/syck/lib/syck.rb (revision 27220) +++ ext/syck/lib/syck.rb (revision 27221) @@ -92,19 +92,19 @@ # Returns a new generic parser def self.generic_parser - warn "#{caller[0]}: YAML.generic_parser is deprecated, switch to psych" if $VERBOSE + warn "#{caller[0]}: YAML.generic_parser is deprecated, switch to psych" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) Parser.new.set_resolver( GenericResolver ) end # Returns the default resolver def self.resolver - warn "#{caller[0]}: YAML.resolver is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.resolver is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) DefaultResolver end # Returns a new default emitter def self.emitter - warn "#{caller[0]}: YAML.emitter is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.emitter is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) Emitter.new.set_resolver( self.resolver ) end @@ -222,7 +222,7 @@ # end # def self.each_document( io, &block ) - warn "#{caller[0]}: YAML.each_document is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.each_document is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) yp = parser.load_documents( io, &block ) end @@ -253,7 +253,7 @@ # end # def self.each_node( io, &doc_proc ) - warn "#{caller[0]}: YAML.each_node is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.each_node is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) yp = generic_parser.load_documents( io, &doc_proc ) end @@ -269,7 +269,7 @@ # end # def self.parse_documents( io, &doc_proc ) - warn "#{caller[0]}: YAML.parse_documents is deprecated, use load_stream" if $VERBOSE + warn "#{caller[0]}: YAML.parse_documents is deprecated, use load_stream" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) self.each_node( io, &doc_proc ) end @@ -322,7 +322,7 @@ # Add a transfer method for a builtin type # def self.add_ruby_type( type_tag, &transfer_proc ) - warn "#{caller[0]}: YAML.add_ruby_type is deprecated, use add_domain_type" if $VERBOSE + warn "#{caller[0]}: YAML.add_ruby_type is deprecated, use add_domain_type" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) resolver.add_type( "tag:ruby.yaml.org,2002:#{ type_tag }", transfer_proc ) end @@ -330,7 +330,7 @@ # Add a private document type # def self.add_private_type( type_re, &transfer_proc ) - warn "#{caller[0]}: YAML.add_private_type is deprecated, use add_domain_type" if $VERBOSE + warn "#{caller[0]}: YAML.add_private_type is deprecated, use add_domain_type" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) resolver.add_type( "x-private:" + type_re, transfer_proc ) end @@ -338,7 +338,7 @@ # Detect typing of a string # def self.detect_implicit( val ) - warn "#{caller[0]}: YAML.detect_implicit is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.detect_implicit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) resolver.detect_implicit( val ) end @@ -346,7 +346,7 @@ # Convert a type_id to a taguri # def self.tagurize( val ) - warn "#{caller[0]}: YAML.tagurize is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.tagurize is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) resolver.tagurize( val ) end @@ -354,7 +354,7 @@ # Apply a transfer method to a Ruby object # def self.transfer( type_id, obj ) - warn "#{caller[0]}: YAML.transfer is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.transfer is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) resolver.transfer( tagurize( type_id ), obj ) end @@ -362,7 +362,7 @@ # Apply any implicit a node may qualify for # def self.try_implicit( obj ) - warn "#{caller[0]}: YAML.try_implicit is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.try_implicit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) transfer( detect_implicit( obj ), obj ) end @@ -371,7 +371,7 @@ # the type and the constant of the class # def self.read_type_class( type, obj_class ) - warn "#{caller[0]}: YAML.read_type_class is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.read_type_class is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) scheme, domain, type, tclass = type.split( ':', 4 ) tclass.split( "::" ).each { |c| obj_class = obj_class.const_get( c ) } if tclass return [ type, obj_class ] @@ -381,7 +381,7 @@ # Allocate blank object # def self.object_maker( obj_class, val ) - warn "#{caller[0]}: YAML.object_maker is deprecated" if $VERBOSE + warn "#{caller[0]}: YAML.object_maker is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) if Hash === val o = obj_class.allocate val.each_pair { |k,v| @@ -397,9 +397,7 @@ # Allocate an Emitter if needed # def self.quick_emit( oid, opts = {}, &e ) - if $VERBOSE && /syck\/rubytypes\.rb:\d+:in `to_yaml'/ !~ caller[0] - warn "#{caller[0]}: YAML.quick_emit is deprecated" - end + warn "#{caller[0]}: YAML.quick_emit is deprecated" if $VERBOSE && !caller[0].start_with?(File.dirname(__FILE__)) out = if opts.is_a? Emitter opts Index: test/rubygems/gemutilities.rb =================================================================== --- test/rubygems/gemutilities.rb (revision 27220) +++ test/rubygems/gemutilities.rb (revision 27221) @@ -138,24 +138,9 @@ @pre_uninstall_hook_arg = uninstaller end - Object.class_eval %q{ - alias tmp_to_yaml to_yaml - def to_yaml( opts = {} ) - YAML::quick_emit( self, opts ) do |out| - out.map( taguri, to_yaml_style ) do |map| - to_yaml_properties.each do |m| - map.add( m[1..-1], instance_variable_get( m ) ) - end - end - end - end - } end def teardown - Object.class_eval %q{ - alias to_yaml tmp_to_yaml - } Gem::ConfigMap[:BASERUBY] = @orig_BASERUBY Gem::ConfigMap[:arch] = @orig_arch -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/