mirror of
https://github.com/github/rails.git
synced 2026-04-26 03:00:59 -04:00
Added doc about pluck for active_support core ext
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user