mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syck/rubyext.c (rb_syck_load_handler): merge key implemented.
* ext/syck/rubyext.c (transfer_find_i): removed use of String#=~ in favor of Regexp#match. * lib/yaml.rb: YAML::try_implicit returns. * lib/yaml/rubytypes.rb: Regexps added for type matching. * lib/yaml/emitter.rb: fix String + nil error. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3955 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ae28f1b6b3
commit
d21bd1c06d
5 changed files with 112 additions and 20 deletions
|
@ -30,7 +30,7 @@ class Object
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( 'object' ) { |type, val|
|
||||
YAML.add_ruby_type( /^object/ ) { |type, val|
|
||||
type, obj_class = YAML.read_type_class( type, Object )
|
||||
YAML.object_maker( obj_class, val )
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ hash_proc = Proc.new { |type, val|
|
|||
val
|
||||
}
|
||||
YAML.add_builtin_type( 'map', &hash_proc )
|
||||
YAML.add_ruby_type( 'hash', &hash_proc )
|
||||
YAML.add_ruby_type( /^hash/, &hash_proc )
|
||||
|
||||
module YAML
|
||||
|
||||
|
@ -166,7 +166,7 @@ class Struct
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( 'struct' ) { |type, val|
|
||||
YAML.add_ruby_type( /^struct/ ) { |type, val|
|
||||
if Hash === val
|
||||
struct_type = nil
|
||||
|
||||
|
@ -238,7 +238,7 @@ array_proc = Proc.new { |type, val|
|
|||
end
|
||||
}
|
||||
YAML.add_builtin_type( 'seq', &array_proc )
|
||||
YAML.add_ruby_type( 'array', &array_proc )
|
||||
YAML.add_ruby_type( /^array/, &array_proc )
|
||||
|
||||
#
|
||||
# Exception#to_yaml
|
||||
|
@ -262,7 +262,7 @@ class Exception
|
|||
end
|
||||
end
|
||||
|
||||
YAML.add_ruby_type( 'exception' ) { |type, val|
|
||||
YAML.add_ruby_type( /^exception/ ) { |type, val|
|
||||
type, obj_class = YAML.read_type_class( type, Exception )
|
||||
o = YAML.object_maker( obj_class, { 'mesg' => val.delete( 'message' ) }, true )
|
||||
val.each_pair { |k,v|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue