diff options
author | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-10-22 14:27:55 -0500 |
---|---|---|
committer | Francesco Rodriguez <lrodriguezsanc@gmail.com> | 2012-10-22 14:27:55 -0500 |
commit | 2ef4d5ed5cbbb2a9266c99535e5f51918ae3e3b6 (patch) | |
tree | 406457f6157c5b6b6ec86572ac9fb748b6a50422 /activesupport | |
parent | 77eb1fb22d0f25183eb608b8ae55d9f1eb8bec59 (diff) | |
download | rails-2ef4d5ed5cbbb2a9266c99535e5f51918ae3e3b6.tar.gz rails-2ef4d5ed5cbbb2a9266c99535e5f51918ae3e3b6.tar.bz2 rails-2ef4d5ed5cbbb2a9266c99535e5f51918ae3e3b6.zip |
fix output messages - docs [ci skip]
Diffstat (limited to 'activesupport')
4 files changed, 6 insertions, 6 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 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 |