Say I have a ruby method:
def blah(foo=17)
...
end
In code I want to invoke blah with a specific argument "blah(a)" or invoke blah using its default argument "blah()" Is there any way to do that without specifying the method name twice? I'm trying to avoid:
if a.nil?
blah()
else
blah(a)
end
Because it makes the code look more complicated than it is. Best I can come up with (didn't test) is:
args=[]
args << a unless a.nil?
a.send :blah, args