- Notifications
You must be signed in to change notification settings - Fork 24
Closed
Description
I hope OptionParser to support Range object such as (1..3) in order to restrict option values.
Currently, OptionParser#on() raises NoMethodError when range object specified.
Example (ex3.rb):
require 'optparse' parser = OptionParser.new parser.on("-x <N>", "int", Integer, (1..3)) #=> NoMethodError #### exception detail # lib/optparse.rb:1509:in `block in make_switch': undefined method `empty?' for an instance of Range (NoMethodError) # # desc.push(o) if o && !o.empty? # ^^^^^^^ # from lib/optparse.rb:1411:in `each' # from lib/optparse.rb:1411:in `make_switch' # from lib/optparse.rb:1541:in `define' # from lib/optparse.rb:1551:in `on' # from ex3.rb:4:in `<main>'Environment:
- optparse.rb 0.4.0 & 0.5.0
- Ruby 3.3.5
I can submit a pull request for this issue. Let me know if necessary.
Metadata
Metadata
Assignees
Labels
No labels