Reputation: 302
I am having trouble understanding the following:
@on_fallback = on_fallback || (->(_, _){})
Could anybody please assist me in understanding the code that executes after the disjunciton operator?
Upvotes: 0
Views: 63
Reputation: 168071
It is a lambda that takes two block arguments and returns nil
when executed.
When _
is used in an argument position of a method definition, lambda, or block, it indicates an argument that is not to be used in its scope. Unlike other argument names, _
can appear multiple times in a scope.
Upvotes: 2