mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/syck/lib/syck/rubytypes.rb (Exception.yaml_new): fix bug
that causes YAML serialization problem for Exception. Exception#initialize doesn't use visible instance variable for the exception message, so call the method with the message. patched by Jingwen Owen Ou <jingweno AT gmail.com>. http://github.com/ruby/ruby/pull/41 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
a2749dbbf1
commit
eb1eee03ca
3 changed files with 12 additions and 2 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
Mon Mar 5 17:11:44 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/syck/lib/syck/rubytypes.rb (Exception.yaml_new): fix bug
|
||||||
|
that causes YAML serialization problem for Exception.
|
||||||
|
Exception#initialize doesn't use visible instance variable for
|
||||||
|
the exception message, so call the method with the message.
|
||||||
|
patched by Jingwen Owen Ou <jingweno AT gmail.com>.
|
||||||
|
http://github.com/ruby/ruby/pull/41
|
||||||
|
|
||||||
Mon Mar 5 16:50:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
Mon Mar 5 16:50:22 2012 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||||
|
|
||||||
* test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): syntax error.
|
* test/ruby/test_sleep.rb (TestSleep#test_sleep_5sec): syntax error.
|
||||||
|
|
|
@ -122,7 +122,8 @@ end
|
||||||
class Exception
|
class Exception
|
||||||
yaml_as "tag:ruby.yaml.org,2002:exception"
|
yaml_as "tag:ruby.yaml.org,2002:exception"
|
||||||
def Exception.yaml_new( klass, tag, val )
|
def Exception.yaml_new( klass, tag, val )
|
||||||
o = YAML.object_maker( klass, { 'mesg' => val.delete( 'message' ) } )
|
o = klass.allocate
|
||||||
|
Exception.instance_method(:initialize).bind(o).call(val.delete('message'))
|
||||||
val.each_pair do |k,v|
|
val.each_pair do |k,v|
|
||||||
o.instance_variable_set("@#{k}", v)
|
o.instance_variable_set("@#{k}", v)
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,7 +13,7 @@ module Syck
|
||||||
end
|
end
|
||||||
|
|
||||||
def setup
|
def setup
|
||||||
@wups = Wups.new
|
@wups = Wups.new('test_message')
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_to_yaml
|
def test_to_yaml
|
||||||
|
|
Loading…
Add table
Reference in a new issue