1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Added doc about pluck for active_support core ext

This commit is contained in:
Arun Agrawal 2011-12-02 23:15:08 +05:30
parent 9f623e2109
commit 3d550e5174

View file

@ -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: