-
Notifications
You must be signed in to change notification settings - Fork 13.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Case Insensitive OptEnum #19450
Labels
suggestion-feature
New feature suggestions
Comments
Not a blocker to anything:
Some data mining on more detailed module metadata cache shows that there isn't any modules that have case sensitive enums:
We could probably add validation to ensure this is always the case |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It'd be really nice if
OptEnum
were updated to validate values without being case sensitive while preserving the case the author was expecting.For example a setting
OptEnum.new('PROTOCOL', [true, 'Protocol to use.', 'TCP', [ 'TCP', 'UDP', 'ALL' ]]),
should acceptall
and normalize it toALL
.In the vast majority (maybe all) cases of OptEnum's being used, the values are all unique regardless of case. Allowing the user to set them to their value without needing to worry about the details of how the casing was defined by the author would be a nice improvement. If the possible values are case sensitive
(
opts.length == opts.map(&:upcase).uniq.length
) then this should be disabled for the option.Simple example
In this case "all" is explicit enough to be differentiated from "TCP" and "UDP".
The text was updated successfully, but these errors were encountered: