Using singleton objects as default arguments in Ruby
Sometimes you would like to define a method which takes an optional argument, but the programmer might pass nil
. And your code needs to distinguish between the value not being provided (default value) and nil
. How can it be achieved?