diff options
author | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-22 02:51:14 +0000 |
---|---|---|
committer | tenderlove <tenderlove@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-01-22 02:51:14 +0000 |
commit | 6e5aa6311a5798145daf0c42ce0a757c333f7155 (patch) | |
tree | 98c1d4f63de5396cac034eea48b875eccad16645 /ext | |
parent | 5b1c06c74b65e12c8e552bacf6faed5c0b2826cd (diff) | |
download | ruby-6e5aa6311a5798145daf0c42ce0a757c333f7155.tar.gz |
* ext/psych/lib/psych/visitors/to_ruby.rb: fixing merge key support
when multiple merge keys are specified.
* test/psych/test_merge_keys.rb: tests for multi-merge key support
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index b5bec54af5..7f0ddff96c 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -187,8 +187,17 @@ module Psych o.children.each_slice(2) { |k,v| key = accept(k) - if key == '<<' && Nodes::Alias === v - hash.merge! accept(v) + if key == '<<' + case v + when Nodes::Alias + hash.merge! accept(v) + when Nodes::Sequence + accept(v).reverse_each do |value| + hash.merge! value + end + else + hash[key] = accept(v) + end else hash[key] = accept(v) end |