Convert to Hash
to_h
is the only to_...
like method to accept a block! This avoids the need for an intermediate array, which was often necessary before conversion! The proposal was initially rejected for lack of a better name.
Links to Ruby documentation for to_h
and the history of issue 15143.