In my Rails app I have this (rather silly) method:
def my_method(param)
foo = "hey"
bar = "ho"
if param == :foo
return foo
elsif param == :bar
return bar
end
end
I don't like the if/else
block, though.
Is there a simpler way to return the value of the local variable foo
if :foo
is provided as a parameter?
Or will I have to use an array or a hash here?