I defined a method:
def method(one: 1, two: 2)
[one, two]
end
and when I call it like this:
method one: 'one', three: 'three'
I get:
ArgumentError: unknown keyword: three
I do not want to extract desired keys from a hash one by one or exclude extra keys. Is there way to circumvent this behaviour except defining the method like this:
def method(one: 1, two: 2, **other)
[one, two, other]
end
If you don't want to write the other
as in **other
, you can omit it.
def method(one: 1, two: 2, **)
[one, two]
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With