summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2009-11-17 20:01:16 -0800
committerAaron Patterson <aaron.patterson@gmail.com>2009-11-17 20:01:16 -0800
commit83ff66422fd23f883a90a65b25644267a27e25bf (patch)
treeeee597e16bc7387985b21520f3634bdba21340f3 /lib
parentccc1107595545a7947080d919529102d3e8c6dfe (diff)
downloadpsych-83ff66422fd23f883a90a65b25644267a27e25bf.zip
adding a method for fetching private instance variables
Diffstat (limited to 'lib')
-rw-r--r--lib/psych/visitors/yaml_tree.rb11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb
index 0f0e3ba..57d23e2 100644
--- a/lib/psych/visitors/yaml_tree.rb
+++ b/lib/psych/visitors/yaml_tree.rb
@@ -62,11 +62,16 @@ module Psych
end
def visit_Exception o
- tag = ['!ruby/exception', o.class.name].compact.join(':')
+ tag = ['!ruby/exception', o.class.name].join ':'
@stack.push append Nodes::Mapping.new(nil, tag, false)
- ['message', o.message].each do |m|
- accept m
+ {
+ 'message' => private_iv_get(o, 'mesg'),
+ 'backtrace' => private_iv_get(o, 'backtrace'),
+ }.each do |k,v|
+ next unless v
+ append Nodes::Scalar.new k
+ accept v
end
if o.respond_to? :to_yaml_properties