-
- Downloads
ARGV: fix 'value' method, make it more predictable
The fix changes behavior in same cases, but those cases were all either
broken or showed unexpected behavior. The new behavior is very simple:
- If an argument starts with `--<option-name>=`, return whatever comes
after the equals sign.
Prior to this change, `ARGV.value` showed some unexpected behavior:
- `ARGV.value("foo")` returned `nil` for `--foo=` because at least one
character needed to be present after the equals sign. (All other
option parser implementations I'm aware of allow for empty values.)
- `ARGV.value("bar")` returned `"baz"` for `--foo=--bar=baz` because the
regular expression was not anchored to the start of the argument.
- `ARGV.value("++")` raised an exception because the string wasn't
escaped for use in the regular expression. (An unlikely corner case.)
Closes #231.
Signed-off-by:
Martin Afanasjew <martin@afanasjew.de>
Loading
Please register or sign in to comment