4 ms·
Ruby supports that too. Here's a snippet that shows named arguments, and unpacking a Hash into named arguments. It can do multiple assignment and unpacking col
by vidarh 9y ago
Ruby supports that too. Here's a snippet that shows named arguments, and unpacking a Hash into named arguments.
It can do multiple assignment and unpacking collections into them too, though unlike with named arguments, that will treat the collection as an Array:
def foo bar:, baz:
p [bar, baz]
end
h = {bar: 1, baz: 2}
foo(h)
- deleted 9y ago[deleted]