This:
[{a: 1, b: 2}, {a: 3, b: 4}].each do |a:, b:| p a end
Raises the following warning in Ruby 2.7
warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call
I understand that each
is passing a hash to the block, and the block now accepts |a:, b:|
as named arguments but, is there any way to correctly destructure the hash in this context?