Numbered Parameters to Blocks in Ruby
Ruby blocks offer a shorthand to positional block variables.
Normally you'd see a block like this:
However with Numbered Parameters, introduced in Ruby 2.7, we can express this like so:
The _1
takes the place of an explicitly defined block variable.