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:
parent
9f623e2109
commit
3d550e5174
1 changed files with 10 additions and 0 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue