Bug #722: optparse needs patch in 1.9
http://redmine.ruby-lang.org/issues/show/722

Author: Keith Cascio
Status: Open, Priority: Normal
Assigned to: Nobuyoshi Nakada, Category: lib, Target version: 1.9.1

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


----------------------------------------
http://redmine.ruby-lang.org