Bug #722
closedoptparse needs patch in 1.9
Description
=begin
Ruby 1.9 breaks this case because Symbol now responds to :match. Patch included.
ruby -r optparse -e 'OptionParser.new{ |o| o.on( "-t ", :REQUIRED ){ |v| p v } }.parse!' -- -t foo
/usr/local/lib/ruby/1.9.1/optparse.rb:326:inmatch': 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:inparse' 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:incatch' 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:inorder!' from /usr/local/lib/ruby/1.9.1/optparse.rb:1333:in
permute!'
from /usr/local/lib/ruby/1.9.1/optparse.rb:1354:inparse!' from -e:1:in
'
ruby -r ./optparse.patched.rb -e 'OptionParser.new{ |o| o.on( "-t ", :REQUIRED ){ |v| p v } }.parse!' -- -t foo
"foo"
-- Keith Cascio
=end
Files