Skip to content

Instantly share code, notes, and snippets.

@bmizerany
Created December 31, 2010 01:09
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bmizerany/760583 to your computer and use it in GitHub Desktop.
Save bmizerany/760583 to your computer and use it in GitHub Desktop.
# 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
@topfunky
Copy link

That feels like something _why would do.

Which is to say, awesome.

@bmizerany
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment