Created
December 31, 2010 01:09
-
-
Save bmizerany/760583 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# When anything, including nil, is a valid param and you need | |
# a clear way to know if a param was set or not, use `None`. | |
None = Object.new | |
def foo(a, b=None) | |
result = [a] | |
if b != None | |
result << b | |
end | |
result | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
That feels like something _why would do.
Which is to say, awesome.