Enhance to support 'Set' object as an enum#76
Conversation
Added new test script |
lang_set = Set.new(["en", "fr", "it"])
parser.on("--lang2=<lang>", lang_set.to_a) |
|
I already explained the reason for OptionParser to support Set object.
The order of elements in enum values for OptionParser is not important. In Ruby, it is true that Array object can be used in many cases instead of Set object. However, this request arised from philosopy of software and library design rather than from practical benefit of library functionality. |
(ruby/optparse#76) * Enhance to support 'Set' object as an enum * Add test script for '#make_swithc()' --------- ruby/optparse@3869000e98 Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
OptionParser supports Array and Hash object as an enum of option value.
But Set object is not supported.
For example:
Since Ruby 3.2, Set class is a built-in class.
I think that it is very natural for OptionParser to support Set object.
By the way, I can't find a test script to test
OptionParser#make_switch()method.Therefore this pull request doesn't contain any test case.