[ruby/optparse] Allow non-string enum list #79

Command line arguments are strings, convert enum list elements to
strings to match.

c5ec052efc
This commit is contained in:
Nobuyoshi Nakada 2025-03-09 22:39:12 +09:00 committed by git
parent 213c27825a
commit cdf36d6bfd
2 changed files with 7 additions and 1 deletions

View file

@ -1503,7 +1503,7 @@ XXX
else
raise ArgumentError, "argument pattern given twice"
end
o.each {|pat, *v| pattern[pat] = v.fetch(0) {pat}}
o.each {|pat, *v| pattern[pat.to_s] = v.fetch(0) {pat}}
when Module
raise ArgumentError, "unsupported argument type: #{o}", ParseError.filter_backtrace(caller(4))
when *ArgumentStyle.keys