From 3d550e5174d99e12fc7efe8273aa4eb970cfeeaf Mon Sep 17 00:00:00 2001 From: Arun Agrawal Date: Fri, 2 Dec 2011 23:15:08 +0530 Subject: Added doc about pluck for active_support core ext --- railties/guides/source/active_support_core_extensions.textile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'railties/guides') diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index fbccff5005..76d757f6a7 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/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 + + +people.pluck(:name) # => [ "David Heinemeier Hansson", "Jamie Heinemeier Hansson" ] + + +NOTE: Defined in +active_support/core_ext/enumerable.rb+. + h4. +each_with_object+ The +inject+ method offers iteration with an accumulator: -- cgit v1.2.3