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.


Using singleton objects as default arguments in Ruby #ruby #rubydeveloper #rubyonrails https://rubyonrails.ba/single/using-singleton-objects-as-default-arguments-in-ruby

Nezir Zahirovic

Contractor Ruby On Rails (8+ years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles