Thomas Sawyer wrote:
> So it occurs to me tonight that
> we already have #has_block? to see if a block was passed. So how about
> a #has_arguments? to query if _any_ arguments have been passed. So
> then...
> 
>   def meth(a=default)
>     if has_arguments?
>        ...
>     else
>       ...
>     end
>   end
> 
> Ah... now that would be nice.

But it doesn't solve the general case of

  def meth(a, b, c=default)
    ...
  end

You could have argument_size I suppose. I've never felt the need.

Generally the only time I've done this is with methods which have a hash 
of options, in which case 'has_key?' does the job.
-- 
Posted via http://www.ruby-forum.com/.