3 ms·
Named arguments in much of the Rails API are received by the method via a single hash parameter, not as individual lexically bound variables. In most cases, Ru
by inopinatus 6y ago
Named arguments in much of the Rails API are received by the method via a single hash parameter, not as individual lexically bound variables.
In most cases, Ruby handles this capture via a double-splat operator in the parameter list.
However, Ruby itself does have both positional and named method parameters. The former contribute to arity and may be overridden and renamed in subclasses, and this remains true for Rails methods accepting positional arguments.
It is also the case that a hash is implicitly congruent to named arguments, although this is controversial and may change in future. I’m sorry to report that no-one has ever described this as “arg hash” or “argh” for short.