mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/psych/lib/psych/core_ext.rb: remove before alias.
* ext/syck/lib/syck.rb: don't warn called by itself. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f1c86c1bb2
commit
10c9ed2493
4 changed files with 25 additions and 33 deletions
|
@ -1,3 +1,9 @@
|
|||
Mon Apr 5 13:10:35 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* win32/mkexports.rb (each_export): VC10 support.
|
||||
|
|
|
@ -12,11 +12,14 @@ class Object
|
|||
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
|
||||
|
|
|
@ -92,19 +92,19 @@ module Syck
|
|||
|
||||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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 @@ module Syck
|
|||
# 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
|
||||
|
|
|
@ -138,24 +138,9 @@ class RubyGemTestCase < MiniTest::Unit::TestCase
|
|||
@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
|
||||
|
||||
|
|
Loading…
Reference in a new issue