aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/core_ext/array
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/lib/active_support/core_ext/array')
-rw-r--r--activesupport/lib/active_support/core_ext/array/conversions.rb6
-rw-r--r--activesupport/lib/active_support/core_ext/array/extract_options.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/array/grouping.rb4
-rw-r--r--activesupport/lib/active_support/core_ext/array/uniq_by.rb1
-rw-r--r--activesupport/lib/active_support/core_ext/array/wrap.rb4
5 files changed, 9 insertions, 10 deletions
diff --git a/activesupport/lib/active_support/core_ext/array/conversions.rb b/activesupport/lib/active_support/core_ext/array/conversions.rb
index d6ae031c0d..7f37c459c1 100644
--- a/activesupport/lib/active_support/core_ext/array/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/array/conversions.rb
@@ -142,7 +142,7 @@ class Array
#
# Otherwise the root element is "objects":
#
- # [{:foo => 1, :bar => 2}, {:baz => 3}].to_xml
+ # [{ foo: 1, bar: 2}, { baz: 3}].to_xml
#
# <?xml version="1.0" encoding="UTF-8"?>
# <objects type="array">
@@ -164,7 +164,7 @@ class Array
#
# To ensure a meaningful root element use the <tt>:root</tt> option:
#
- # customer_with_no_projects.projects.to_xml(:root => "projects")
+ # customer_with_no_projects.projects.to_xml(root: 'projects')
#
# <?xml version="1.0" encoding="UTF-8"?>
# <projects type="array"/>
@@ -174,7 +174,7 @@ class Array
#
# The +options+ hash is passed downwards:
#
- # Message.all.to_xml(:skip_types => true)
+ # Message.all.to_xml(skip_types: true)
#
# <?xml version="1.0" encoding="UTF-8"?>
# <messages>
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 40ceb3eb9e..9008a0df2a 100644
--- a/activesupport/lib/active_support/core_ext/array/extract_options.rb
+++ b/activesupport/lib/active_support/core_ext/array/extract_options.rb
@@ -17,8 +17,8 @@ class Array
# args.extract_options!
# end
#
- # options(1, 2) # => {}
- # options(1, 2, :a => :b) # => {:a=>:b}
+ # options(1, 2) # => {}
+ # 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/grouping.rb b/activesupport/lib/active_support/core_ext/array/grouping.rb
index a184eb492a..f79b100b3b 100644
--- a/activesupport/lib/active_support/core_ext/array/grouping.rb
+++ b/activesupport/lib/active_support/core_ext/array/grouping.rb
@@ -83,8 +83,8 @@ class Array
# Divides the array into one or more subarrays based on a delimiting +value+
# or the result of an optional block.
#
- # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]]
- # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]]
+ # [1, 2, 3, 4, 5].split(3) # => [[1, 2], [4, 5]]
+ # (1..10).to_a.split { |i| i % 3 == 0 } # => [[1, 2], [4, 5], [7, 8], [10]]
def split(value = nil, &block)
inject([[]]) do |results, element|
if block && block.call(element) || value == element
diff --git a/activesupport/lib/active_support/core_ext/array/uniq_by.rb b/activesupport/lib/active_support/core_ext/array/uniq_by.rb
index 3bedfa9a61..c1d5a355a4 100644
--- a/activesupport/lib/active_support/core_ext/array/uniq_by.rb
+++ b/activesupport/lib/active_support/core_ext/array/uniq_by.rb
@@ -4,7 +4,6 @@ class Array
# Returns a unique array based on the criteria in the block.
#
# [1, 2, 3, 4].uniq_by { |i| i.odd? } # => [1, 2]
- #
def uniq_by(&block)
ActiveSupport::Deprecation.warn 'uniq_by is deprecated. Use Array#uniq instead', caller
uniq(&block)
diff --git a/activesupport/lib/active_support/core_ext/array/wrap.rb b/activesupport/lib/active_support/core_ext/array/wrap.rb
index 9ea93d7226..55582c6487 100644
--- a/activesupport/lib/active_support/core_ext/array/wrap.rb
+++ b/activesupport/lib/active_support/core_ext/array/wrap.rb
@@ -22,8 +22,8 @@ class Array
#
# The last point is particularly worth comparing for some enumerables:
#
- # Array(:foo => :bar) # => [[:foo, :bar]]
- # Array.wrap(:foo => :bar) # => [{:foo => :bar}]
+ # Array(foo: :bar) # => [[:foo, :bar]]
+ # Array.wrap(foo: :bar) # => [{:foo => :bar}]
#
# There's also a related idiom that uses the splat operator:
#