From 7fbb21dc802c9eb96d30c6231e2b3dc473dbe9dd Mon Sep 17 00:00:00 2001 From: AvnerCohen Date: Sun, 21 Oct 2012 22:28:50 +0200 Subject: [PATCH] More changes around 1.9 hash syntax Added missing space in previous hash related commit --- .../lib/active_support/core_ext/array/extract_options.rb | 2 +- .../lib/active_support/core_ext/hash/deep_merge.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/array/extract_options.rb b/activesupport/lib/active_support/core_ext/array/extract_options.rb index 9008a0df2a..5f153a2cc3 100644 --- a/activesupport/lib/active_support/core_ext/array/extract_options.rb +++ b/activesupport/lib/active_support/core_ext/array/extract_options.rb @@ -18,7 +18,7 @@ class Array # end # # options(1, 2) # => {} - # options(1, 2, a: :b) # => {:a=>:b} + # options(1, 2, a: :b) # => {a: :b} def extract_options! if last.is_a?(Hash) && last.extractable_options? pop diff --git a/activesupport/lib/active_support/core_ext/hash/deep_merge.rb b/activesupport/lib/active_support/core_ext/hash/deep_merge.rb index 83f0c87b04..6ce2847ab5 100644 --- a/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +++ b/activesupport/lib/active_support/core_ext/hash/deep_merge.rb @@ -4,10 +4,10 @@ class Hash # h1 = { x: { y: [4,5,6] }, z: [7,8,9] } # h2 = { x: { y: [7,8,9] }, z: 'xyz' } # - # h1.deep_merge(h2) #=> {:x => {:y => [7, 8, 9]}, :z => "xyz"} - # h2.deep_merge(h1) #=> {:x => {:y => [4, 5, 6]}, :z => [7, 8, 9]} + # h1.deep_merge(h2) #=> {x: {y: [7, 8, 9]}, z: "xyz"} + # h2.deep_merge(h1) #=> {x: {y: [4, 5, 6]}, z: [7, 8, 9]} # h1.deep_merge(h2) { |key, old, new| Array.wrap(old) + Array.wrap(new) } - # #=> {:x => {:y => [4, 5, 6, 7, 8, 9]}, :z => [7, 8, 9, "xyz"]} + # #=> {x: {y: [4, 5, 6, 7, 8, 9]}, z: [7, 8, 9, "xyz"]} def deep_merge(other_hash, &block) dup.deep_merge!(other_hash, &block) end