From: Nikolai Weibull Date: 2011-10-15T01:11:00+09:00 Subject: Re: What’s the best way of checking if an argument has been given or not? On Fri, Oct 14, 2011 at 17:31, Jens Wille wrote: > class A > >  def b(c = d = true)  # or some other truthy value >    if d >      puts 'no argument was given' >    else >      puts c >    end >  end > > end > > can't remember where i first saw it, but it works perfectly ;) Yes, of course! That’s the trick I saw too; checking if the optional argument’s default value was evaluated. Here’s a more general solution that allows you to set d to a value independent of the desired default value for the argument: def m(a = (d = true; nil)) # d will be true if argument a wasn’t specified end One easily forgets how expressive Ruby can be. Or how easily it is to abuse it. Thanks!