diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2009-12-18 17:48:06 -0800 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2009-12-18 17:48:06 -0800 |
commit | f6bc23dcba8588af2f80397ad1eb012064669847 (patch) | |
tree | 40f64712fb067c8a015a76f394393afb148a167d /lib | |
parent | d220465e179f430a72be71c649957f0582226b15 (diff) | |
download | psych-f6bc23dcba8588af2f80397ad1eb012064669847.zip |
slight refactor
Diffstat (limited to 'lib')
-rw-r--r-- | lib/psych/visitors/yaml_tree.rb | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/psych/visitors/yaml_tree.rb b/lib/psych/visitors/yaml_tree.rb index ceea9dc..581da92 100644 --- a/lib/psych/visitors/yaml_tree.rb +++ b/lib/psych/visitors/yaml_tree.rb @@ -33,9 +33,7 @@ module Psych register(o, seq) @stack.push append seq - o.each do |k,v| - accept k => v - end + o.each { |k,v| visit_Hash k => v } @stack.pop end @@ -238,11 +236,9 @@ module Psych end def dump_ivars target, map - if target.respond_to? :to_yaml_properties - ivars = target.to_yaml_properties - else - ivars = target.instance_variables - end + ivars = target.respond_to?(:to_yaml_properties) ? + target.to_yaml_properties : + target.instance_variables ivars.each do |iv| map.children << Nodes::Scalar.new(":#{iv.to_s.sub(/^@/, '')}") |