diff options
| author | Sam Westerman <sam@sampersand.me> | 2025-12-02 07:00:22 +0000 |
|---|---|---|
| committer | git <svn-admin@ruby-lang.org> | 2025-12-02 07:00:53 +0000 |
| commit | 0e22108d60fbd0e338fb6e110ddd81a93b45b592 (patch) | |
| tree | 7c781212131bd8216aa5f23cf8cf207ba1f72c34 | |
| parent | 7df97983be41e893afee6d0012c6dced55ff98f8 (diff) | |
[ruby/optparse] Remove `const_set` and instead use explicit assignments
https://github.com/ruby/optparse/commit/6e2709a5fd
| -rw-r--r-- | lib/optparse.rb | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/optparse.rb b/lib/optparse.rb index e0b0ff011b..aae73c86b3 100644 --- a/lib/optparse.rb +++ b/lib/optparse.rb @@ -2314,42 +2314,42 @@ XXX # Raises when ambiguously completable string is encountered. # class AmbiguousOption < ParseError - const_set(:Reason, 'ambiguous option') + Reason = 'ambiguous option' # :nodoc: end # # Raises when there is an argument for a switch which takes no argument. # class NeedlessArgument < ParseError - const_set(:Reason, 'needless argument') + Reason = 'needless argument' # :nodoc: end # # Raises when a switch with mandatory argument has no argument. # class MissingArgument < ParseError - const_set(:Reason, 'missing argument') + Reason = 'missing argument' # :nodoc: end # # Raises when switch is undefined. # class InvalidOption < ParseError - const_set(:Reason, 'invalid option') + Reason = 'invalid option' # :nodoc: end # # Raises when the given argument does not match required format. # class InvalidArgument < ParseError - const_set(:Reason, 'invalid argument') + Reason = 'invalid argument' # :nodoc: end # # Raises when the given argument word can't be completed uniquely. # class AmbiguousArgument < InvalidArgument - const_set(:Reason, 'ambiguous argument') + Reason = 'ambiguous argument' # :nodoc: end # @@ -2448,9 +2448,11 @@ XXX # and DecimalNumeric. See Acceptable argument classes (in source code). # module Acceptables - const_set(:DecimalInteger, OptionParser::DecimalInteger) - const_set(:OctalInteger, OptionParser::OctalInteger) - const_set(:DecimalNumeric, OptionParser::DecimalNumeric) + # :stopdoc: + DecimalInteger = OptionParser::DecimalInteger + OctalInteger = OptionParser::OctalInteger + DecimalNumeric = OptionParser::DecimalNumeric + # :startdoc: end end |
