Created
April 11, 2011 09:59
-
-
Save brainopia/913306 to your computer and use it in GitHub Desktop.
in response to http://www.harukizaemon.com/2011/04/detecting-unspecified-method-arguments-in-ruby.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def method(variable=((default=true);nil)) | |
puts "Value: #{variable.inspect}, default argument - #{!!default}" | |
end | |
method nil # => Value: nil, default argument - false | |
method # => Value: nil, default argument - true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That's an interesting answer but IMHO unnecessarily complex...