From 7fbb21dc802c9eb96d30c6231e2b3dc473dbe9dd Mon Sep 17 00:00:00 2001 From: AvnerCohen Date: Sun, 21 Oct 2012 22:28:50 +0200 Subject: More changes around 1.9 hash syntax Added missing space in previous hash related commit --- activesupport/lib/active_support/core_ext/array/extract_options.rb | 2 +- activesupport/lib/active_support/core_ext/hash/deep_merge.rb | 6 +++--- 2 files changed, 4 insertions(+), 4 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 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 -- cgit v1.2.3 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 From 1e593db13a83637e5a07a170b7b6a4dbc9b5175e Mon Sep 17 00:00:00 2001 From: Geoffrey Roguelon Date: Wed, 24 Oct 2012 15:08:58 +0200 Subject: Adding a missing parenthesis in the doc of String#parameterize. --- activesupport/lib/active_support/core_ext/string/inflections.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'activesupport') diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb index 6edfcd7493..341e2deec9 100644 --- a/activesupport/lib/active_support/core_ext/string/inflections.rb +++ b/activesupport/lib/active_support/core_ext/string/inflections.rb @@ -38,7 +38,7 @@ class String end # The reverse of +pluralize+, returns the singular form of a word in a string. - # + # # If the optional parameter +locale+ is specified, # the word will be singularized as a word of that language. # By default, this paramter is set to :en. @@ -160,7 +160,7 @@ class String # @person = Person.find(1) # # => # # - # <%= link_to(@person.name, person_path %> + # <%= link_to(@person.name, person_path) %> # # => Donald E. Knuth def parameterize(sep = '-') ActiveSupport::Inflector.parameterize(self, sep) -- cgit v1.2.3