Bug #910

optparse with regexp

Added by rubikitch (rubikitch .) over 3 years ago. Updated about 1 year ago.

[ruby-dev:37515]
Status:Closed Start date:12/20/2008
Priority:Normal Due date:12/24/2008
Assignee:nobu (Nobuyoshi Nakada) % Done:

0%

Category:lib
Target version:1.9.1 Release Candidate
ruby -v:

Description

optparseでオプション引数にマッチすべき正規表現を指定した場合の挙動が変わっています。

#!/usr/local/bin/ruby
require 'optparse'
opts = {}
ARGV.options do |o|
  o.on("-T [level]", /^[0-4]$/) {|x| opts[:T] = x }
  o.parse!
end
puts "opts=#{opts.inspect}"


$ ruby187p72 -v optparse-regexp.rb -T1
ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]
opts={:T=>"1"}
$ ruby19 -v optparse-regexp.rb -T1
ruby 1.9.1 (2008-12-20 revision 20892) [i686-linux]
opts={:T=>["1"]}

Related issues

related to Ruby 1.8 - Bug #909: optparse with regexp Closed 12/20/2008

History

Updated by yugui (Yuki Sonoda) over 3 years ago

  • Due date set to 12/24/2008
  • Category set to lib
  • Assignee set to nobu (Nobuyoshi Nakada)
  • Target version set to 1.9.1 Release Candidate

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Open to Closed
Bug #909 [ruby-dev:37514]と重複

Updated by yugui (Yuki Sonoda) over 3 years ago

  • Status changed from Closed to Assigned
1.9ではまだ発生します。

Updated by nobu (Nobuyoshi Nakada) over 3 years ago

  • Status changed from Assigned to Closed
r20902

Also available in: Atom PDF