liveBook · Manning

It

As explained in The Well-Grounded Rubyist, Fourth Edition

it is Ruby's implicit block parameter that supplies the block's single automatic value without pipe-style parameter syntax.

it is Ruby’s implicit block parameter: a block can receive its single automatic value without declaring a pipe-style parameter. This makes short iterator blocks more compact while preserving the block’s ordinary value flow. section 6.3.8

A compact iterator block

[1,2,3,4,5].each { print it * 10, "," } multiplies each element by ten. The same block can be written with an explicit parameter, but the implicit form removes the parameter list.

The feature fits alongside ordinary block parameters, whose bindings remain distinct from same-named variables outside the block. Blocks can also access and reassign variables already in scope, so parameter scope and surrounding local scope should not be conflated. section 6.3.8

How The Well-Grounded Rubyist, Fourth Edition covers it

How deep it goes
Defines the shorthand and contrasts it with explicit parameters, while stopping short of detailed implementation mechanics.
Examples
Uses array iteration and a custom iteration method to demonstrate direct access to block values.
What it assumes
Assumes familiarity with blocks and block parameters, while reinforcing how parameter bindings differ from surrounding local variables.
What you can do after
Apply it in concise iterator blocks that consume one automatically supplied value.
How it connects
Connects implicit block parameters with blocks, block scope, and closures.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Well-Grounded Rubyist, Fourth Edition. The section links point to the parts of the book it draws on.