Created
May 6, 2009 20:37
-
-
Save kevinrutherford/107726 to your computer and use it in GitHub Desktop.
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 parse(arg, argv, &error) | |
if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0])) # should count as 2 | |
return nil, block, nil | |
end | |
opt = (val = parse_arg(val, &error))[1] # counts as 1; should count as 2 | |
val = conv_arg(*val) | |
if opt and !arg # counts as 1; should count as 2 (or 3?) | |
argv.shift | |
else | |
val[0] = nil | |
end | |
val | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment