Rubyists: What is this called?

Posted by Matt Darby on Stack Overflow See other posts from Stack Overflow or by Matt Darby
Published on 2010-06-18T00:50:23Z Indexed on 2010/06/18 0:53 UTC
Read the original article Hit count: 309

Filed under:

Say I have a pool of enumerables that I want to group by an attribute:

cars = Car.all.group_by(&:color)

Then I want to iterate over those cars like so:

cars.inject([]) do |stack, (color, cars)|
  stack << cars.each do |car|
   ...
  end
end

What is the term for the block variable extension (between the parentheses)?

© Stack Overflow or respective owner

Related posts about ruby