From: Joel VanderWerf Date: 2004-11-05T14:47:53+09:00 Subject: Re: value provided for argument with default value - how to check inside method? itsme213 wrote: > Is there an equivalent of block_given? to check if the caller provided a > value to an argument that had a default value? > > Or do I have to use some sentinel value? AFAIK, you either have to use def foo(*args) and count args, or use hash arguments, which let you test with #key? : def foo(h={}) if h.key?(:bar) puts "You passed :bar=>#{h[:bar]}" else h[:bar] = DEFAULT_BAR end end