Project

General

Profile

Actions

Bug #722

closed

optparse needs patch in 1.9

Added by nluv4hs (Keith Cascio) about 16 years ago. Updated over 13 years ago.

Status:
Closed
ruby -v:
Backport:
[ruby-core:19730]

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: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 '

ruby -r ./optparse.patched.rb -e 'OptionParser.new{ |o| o.on( "-t ", :REQUIRED ){ |v| p v } }.parse!' -- -t foo
"foo"

-- Keith Cascio
=end


Files

optparse.patch (1.09 KB) optparse.patch patches 1 file: lib/optparse.rb nluv4hs (Keith Cascio), 11/08/2008 09:01 AM
Actions

Also available in: Atom PDF

Like0
Like0