diff options
author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-31 03:46:21 +0000 |
---|---|---|
committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-05-31 03:46:21 +0000 |
commit | dd0f22f9cbf592d3ae17b03708ab66b4be7e6640 (patch) | |
tree | 1ec4cb95489c40d8dd4794a3598cc221ea6a6ed3 /ext | |
parent | e9faf5ffabbb5addd1ac298fe8cdcb0e068ea59d (diff) |
merges r30629 and r30630 from trunk into ruby_1_9_2.
--
* ext/psych/lib/psych/visitors/to_ruby.rb: merge keys are actually
part of YAML 1.1, so they should be supported. Remove warning and
merge keys to parent. [ruby-core:34679]
* test/psych/test_merge_keys.rb: test for merge keys
--
* 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/branches/ruby_1_9_2@31856 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r-- | ext/psych/lib/psych/visitors/to_ruby.rb | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/psych/lib/psych/visitors/to_ruby.rb b/ext/psych/lib/psych/visitors/to_ruby.rb index f3441fff92..a68c8e698e 100644 --- a/ext/psych/lib/psych/visitors/to_ruby.rb +++ b/ext/psych/lib/psych/visitors/to_ruby.rb @@ -190,14 +190,17 @@ module Psych o.children.each_slice(2) { |k,v| key = accept(k) - if key == '<<' && Nodes::Alias === v - # FIXME: remove this when "<<" syntax is deprecated - if $VERBOSE - where = caller.find { |x| x !~ /psych/ } - warn where - warn "\"<<: *#{v.anchor}\" is no longer supported, please switch to \"*#{v.anchor}\"" + 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 - return accept(v) else hash[key] = accept(v) end |