File tree Expand file tree Collapse file tree 4 files changed +67
-5
lines changed Expand file tree Collapse file tree 4 files changed +67
-5
lines changed Original file line number Diff line number Diff line change
1
+ Tue Mar 6 12:05:42 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
2
+
3
+ * lib/yaml/rubytypes.rb (Exception.yaml_new): fix bug that causes
4
+ YAML serialization problem for Exception.
5
+ Exception#initialize doesn't use visible instance variable for
6
+ the exception message, so call the method with the message.
7
+ patched by Jingwen Owen Ou <jingweno AT gmail.com>.
8
+ http://github.com/ruby/ruby/pull/41
9
+
1
10
Fri Mar 2 11:44:33 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
2
11
3
12
* marshal.c (mark_dump_arg): mark destination string. patch by
Original file line number Diff line number Diff line change @@ -117,7 +117,8 @@ def to_yaml( opts = {} )
117
117
class Exception
118
118
yaml_as "tag:ruby.yaml.org,2002:exception"
119
119
def Exception . yaml_new ( klass , tag , val )
120
- o = YAML . object_maker ( klass , { 'mesg' => val . delete ( 'message' ) } )
120
+ o = klass . allocate
121
+ Exception . instance_method ( :initialize ) . bind ( o ) . call ( val . delete ( 'message' ) )
121
122
val . each_pair do |k , v |
122
123
o . instance_variable_set ( "@#{ k } " , v )
123
124
end
Original file line number Diff line number Diff line change
1
+ require 'test/unit'
2
+ require 'yaml'
3
+
4
+ module Syck
5
+ class TestException < Test ::Unit ::TestCase
6
+ class Wups < Exception
7
+ attr_reader :foo , :bar
8
+ def initialize *args
9
+ super
10
+ @foo = 1
11
+ @bar = 2
12
+ end
13
+
14
+ def ==( other )
15
+ self . class == other . class and
16
+ self . message == other . message and
17
+ self . backtrace == other . backtrace
18
+ end
19
+ end
20
+
21
+ def setup
22
+ @wups = Wups . new ( 'test_message' )
23
+ end
24
+
25
+ def test_to_yaml
26
+ w = YAML . load ( @wups . to_yaml )
27
+ assert_equal @wups , w
28
+ assert_equal 1 , w . foo
29
+ assert_equal 2 , w . bar
30
+ end
31
+
32
+ def test_dump
33
+ w = YAML . load ( @wups . to_yaml )
34
+ assert_equal @wups , w
35
+ assert_equal 1 , w . foo
36
+ assert_equal 2 , w . bar
37
+ end
38
+
39
+ def test_to_yaml_properties
40
+ class << @wups
41
+ def to_yaml_properties
42
+ [ :@foo ]
43
+ end
44
+ end
45
+
46
+ w = YAML . load ( YAML . dump ( @wups ) )
47
+ assert_equal @wups , w
48
+ assert_equal 1 , w . foo
49
+ assert_nil w . bar
50
+ end
51
+ end
52
+ end
Original file line number Diff line number Diff line change 1
1
#define RUBY_VERSION "1.8.7"
2
- #define RUBY_RELEASE_DATE "2012-03-02 "
2
+ #define RUBY_RELEASE_DATE "2012-03-06 "
3
3
#define RUBY_VERSION_CODE 187
4
- #define RUBY_RELEASE_CODE 20120302
5
- #define RUBY_PATCHLEVEL 359
4
+ #define RUBY_RELEASE_CODE 20120306
5
+ #define RUBY_PATCHLEVEL 360
6
6
7
7
#define RUBY_VERSION_MAJOR 1
8
8
#define RUBY_VERSION_MINOR 8
9
9
#define RUBY_VERSION_TEENY 7
10
10
#define RUBY_RELEASE_YEAR 2012
11
11
#define RUBY_RELEASE_MONTH 3
12
- #define RUBY_RELEASE_DAY 2
12
+ #define RUBY_RELEASE_DAY 6
13
13
14
14
#ifdef RUBY_EXTERN
15
15
RUBY_EXTERN const char ruby_version [];
You can’t perform that action at this time.
0 commit comments