Created
January 31, 2012 18:07
-
-
Save jzellman/1711932 to your computer and use it in GitHub Desktop.
Var Args 3
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
# Always returns true, ignores arguments | |
def always_true(*) | |
true | |
end | |
always_true | |
=> true | |
always_true(false) | |
=> true | |
# ignores all the args except the first | |
def ignore_rest(arg1, *) | |
arg1 | |
end | |
ignore_rest("foo", "bar", "baz") | |
=> "foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment