Reputation: 397
Lets say I have a method foo:
def foo(options = {})
...
end
I want to pass a variable as the key.
fooKey = "option1"
foo(fooKey: "bar1", option2: 'bar2')
Is this possible?
Upvotes: 0
Views: 68
Reputation: 230286
Just use the hashrocket syntax
foo(fooKey => 'bar1', :option2 => 'bar2')
Upvotes: 3