Bug #722
optparse needs patch in 1.9
| Status: | Closed | Start date: | 11/08/2008 | |
|---|---|---|---|---|
| Priority: | Normal | Due date: | ||
| Assignee: | % Done: | 100% |
||
| Category: | lib | |||
| Target version: | 1.9.1 Release Candidate | |||
| ruby -v: |
Description
Ruby 1.9 breaks this case because Symbol now responds to :match. Patch included.
> ruby -r optparse -e 'OptionParser.new{ |o| o.on( "-t <tum>", :REQUIRED ){ |v| p v } }.parse!' -- -t foo
/usr/local/lib/ruby/1.9.1/optparse.rb:326:in `match': type mismatch: String given (TypeError)
from /usr/local/lib/ruby/1.9.1/optparse.rb:326:in `parse_arg'
from /usr/local/lib/ruby/1.9.1/optparse.rb:455:in `parse'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1289:in `block in parse_in_order'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1248:in `catch'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1248:in `parse_in_order'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1242:in `order!'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1333:in `permute!'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1354:in `parse!'
from -e:1:in `<main>'
> ruby -r ./optparse.patched.rb -e 'OptionParser.new{ |o| o.on( "-t <tum>", :REQUIRED ){ |v| p v } }.parse!' -- -t foo
"foo"
-- Keith Cascio
Associated revisions
* lib/optparse.rb (OptionParser#make_switch): 1.9 Symbols respond
to :match. a patch from keith cascio, <keith at ucla.edu>.
[ruby-core:19730]
History
Updated by Yukihiro Matsumoto over 3 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
Applied in changeset r20149.