aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-12-22 12:21:29 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-12-22 12:21:29 -0700
commitc0563cec6d87adafa99e3b86356c0e912e00030e (patch)
treefc8cec7685252c98788995ea2d8a1e9c70584e93
parent1945bafba2dba80ae0e5595127361fed8bb2d5de (diff)
downloadrails-c0563cec6d87adafa99e3b86356c0e912e00030e.tar.gz
rails-c0563cec6d87adafa99e3b86356c0e912e00030e.tar.bz2
rails-c0563cec6d87adafa99e3b86356c0e912e00030e.zip
Revert "Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH*"
This reverts commit 4d20de8a50d889a09e6f5642984775fe796ca943.
-rw-r--r--activesupport/CHANGELOG.md6
-rw-r--r--activesupport/lib/active_support/core_ext/enumerable.rb7
-rw-r--r--activesupport/test/core_ext/enumerable_test.rb9
3 files changed, 3 insertions, 19 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 1516472fed..d32c094b13 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,9 +1,7 @@
## Rails 3.2.0 (unreleased) ##
-* Added Enumerable#pluck to wrap the common pattern of collect(&:method) *DHH*
-
-* Module#synchronize is deprecated with no replacement. Please use `monitor`
- from ruby's standard library.
+* Module#synchronize is deprecated with no replacement. Please use `monitor`
+ from ruby's standard library.
* (Date|DateTime|Time)#beginning_of_week accept an optional argument to
be able to set the day at which weeks are assumed to start.
diff --git a/activesupport/lib/active_support/core_ext/enumerable.rb b/activesupport/lib/active_support/core_ext/enumerable.rb
index d9856f2e84..9343bb7106 100644
--- a/activesupport/lib/active_support/core_ext/enumerable.rb
+++ b/activesupport/lib/active_support/core_ext/enumerable.rb
@@ -63,13 +63,6 @@ module Enumerable
end
end
- # Plucks the value of the passed method for each element and returns the result as an array. Example:
- #
- # people.pluck(:name) # => [ "David Heinemeier Hansson", "Jamie Heinemeier Hansson" ]
- def pluck(method)
- collect { |element| element.send(method) }
- end
-
# Iterates over a collection, passing the current element *and* the
# +memo+ to the block. Handy for building up hashes or
# reducing collections down to one object. Examples:
diff --git a/activesupport/test/core_ext/enumerable_test.rb b/activesupport/test/core_ext/enumerable_test.rb
index 7ce7c4d52d..cdfa991a34 100644
--- a/activesupport/test/core_ext/enumerable_test.rb
+++ b/activesupport/test/core_ext/enumerable_test.rb
@@ -126,11 +126,4 @@ class EnumerableTests < Test::Unit::TestCase
assert_equal true, GenericEnumerable.new([ 1 ]).exclude?(2)
assert_equal false, GenericEnumerable.new([ 1 ]).exclude?(1)
end
-
- def test_pluck_single_method
- person = Struct.new(:name)
- people = [ person.new("David"), person.new("Jamie") ]
-
- assert_equal [ "David", "Jamie" ], people.pluck(:name)
- end
-end \ No newline at end of file
+end