From: Florian Gross Date: 2007-01-03T01:20:51+09:00 Subject: Re: Detecting default used in method calls Peter Lynch wrote: > I would like to know if a function has been called with or without an > optional argument. Not very pretty: def fun(a, b = (no_b = true; 5)) if no_b then "Fun(%p): %p" % [a, b] else "Fun(%p, %p)" % [a, b] end end fun(1) # => "Fun(1): 5" fun(1, 2) # => "Fun(1, 2)"