Browse files

Added doc about pluck for active_support core ext

  • Loading branch information...
1 parent 9f623e2 commit 3d550e5174d99e12fc7efe8273aa4eb970cfeeaf @arunagw arunagw committed Dec 2, 2011
Showing with 10 additions and 0 deletions.
  1. +10 −0 railties/guides/source/active_support_core_extensions.textile
View
10 railties/guides/source/active_support_core_extensions.textile
@@ -2053,6 +2053,16 @@ end
NOTE: Defined in +active_support/core_ext/enumerable.rb+.
+h4. +pluck+
+
+Plucks the value of the passed method for each element and returns the result as an array
+
+<ruby>
+people.pluck(:name) # => [ "David Heinemeier Hansson", "Jamie Heinemeier Hansson" ]
+</ruby>
+
+NOTE: Defined in +active_support/core_ext/enumerable.rb+.
+
h4. +each_with_object+
The +inject+ method offers iteration with an accumulator:

0 comments on commit 3d550e5

Please sign in to comment.