Skip to content

Instantly share code, notes, and snippets.

@zachmargolis
Created March 6, 2013 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zachmargolis/5099895 to your computer and use it in GitHub Desktop.
Save zachmargolis/5099895 to your computer and use it in GitHub Desktop.
def x(a: 1, b: 2); end
def y(required, a: 1, b: 2); end
def z(optional = nil, a: 1, b: 2); end
method(:x).arity # => 0, no required args
method(:y).arity # => 1, 1 required arg
method(:z).arity # => -1, 0 required, 1 optional
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment