I
Ian Macdonald
Hello,
Does anyone know of a way to detect whether default parameters are being
used in a method? I'm looking for something like the pseudo-method
'default?' in the following example:
def my_method(foo='bar')
if foo.default?
puts "warning: default value #{foo} being used for 'foo'"
end
end
I suspect Ruby no longer holds any state at this point to reflect the
fact that the caller did not supply a parameter, but I'm hoping there's
some way to do it.
Ian
--
Ian Macdonald | When the wind is great, bow before it; when
System Administrator | the wind is heavy, yield to it.
(e-mail address removed) |
http://www.caliban.org |
|
Does anyone know of a way to detect whether default parameters are being
used in a method? I'm looking for something like the pseudo-method
'default?' in the following example:
def my_method(foo='bar')
if foo.default?
puts "warning: default value #{foo} being used for 'foo'"
end
end
I suspect Ruby no longer holds any state at this point to reflect the
fact that the caller did not supply a parameter, but I'm hoping there's
some way to do it.
Ian
--
Ian Macdonald | When the wind is great, bow before it; when
System Administrator | the wind is heavy, yield to it.
(e-mail address removed) |
http://www.caliban.org |
|