From 2ef4d5ed5cbbb2a9266c99535e5f51918ae3e3b6 Mon Sep 17 00:00:00 2001 From: Francesco Rodriguez Date: Mon, 22 Oct 2012 14:27:55 -0500 Subject: fix output messages - docs [ci skip] --- activesupport/lib/active_support/core_ext/array/extract_options.rb | 2 +- activesupport/lib/active_support/core_ext/array/wrap.rb | 2 +- activesupport/lib/active_support/core_ext/hash/deep_merge.rb | 2 +- activesupport/lib/active_support/core_ext/hash/slice.rb | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'activesupport') 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 5f153a2cc3..9008a0df2a 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/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb index ffaf6ef024..05b09a4c7f 100644 --- a/activesupport/lib/active_support/core_ext/array/wrap.rb +++ b/activesupport/lib/active_support/core_ext/array/wrap.rb @@ -23,7 +23,7 @@ class Array # The last point is particularly worth comparing for some enumerables: # # Array(foo: :bar) # => [[:foo, :bar]] - # Array.wrap(foo: :bar) # => [{foo: :bar}] + # Array.wrap(foo: :bar) # => [{:foo=>:bar}] # # There's also a related idiom that uses the splat operator: # 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 6ce2847ab5..e07db50b77 100644 --- a/activesupport/lib/active_support/core_ext/hash/deep_merge.rb +++ b/activesupport/lib/active_support/core_ext/hash/deep_merge.rb @@ -7,7 +7,7 @@ class Hash # 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 diff --git a/activesupport/lib/active_support/core_ext/hash/slice.rb b/activesupport/lib/active_support/core_ext/hash/slice.rb index a92c5968ed..9fa9b3dac4 100644 --- a/activesupport/lib/active_support/core_ext/hash/slice.rb +++ b/activesupport/lib/active_support/core_ext/hash/slice.rb @@ -21,7 +21,7 @@ class Hash # Returns a hash containing the removed key/value pairs. # # { a: 1, b: 2, c: 3, d: 4 }.slice!(:a, :b) - # # => {c: 3, d: 4} + # # => {:c=>3, :d=>4} def slice!(*keys) keys.map! { |key| convert_key(key) } if respond_to?(:convert_key, true) omit = slice(*self.keys - keys) @@ -32,8 +32,8 @@ class Hash # Removes and returns the key/value pairs matching the given keys. # - # { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => { a: 1, b: 2 } - # { a: 1, b: 2 }.extract!(:a, :x) # => { a: 1 } + # { a: 1, b: 2, c: 3, d: 4 }.extract!(:a, :b) # => {:a=>1, :b=>2} + # { a: 1, b: 2 }.extract!(:a, :x) # => {:a=>1} def extract!(*keys) keys.each_with_object(self.class.new) { |key, result| result[key] = delete(key) if has_key?(key) } end -- cgit v1.2.3