Project

General

Profile

Actions

Bug #909

closed

optparse with regexp

Added by rubikitch (rubikitch .) almost 16 years ago. Updated over 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
[ruby-dev:37514]

Description

=begin
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"}
$ ruby18 -v optparse-regexp.rb -T1
ruby 1.8.7 (2008-12-16 revision 20784) [i686-linux]
opts={:T=>["1"]}
=end


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #910: optparse with regexpClosednobu (Nobuyoshi Nakada)12/20/200812/24/2008Actions
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 16 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r20895.
=end

Actions

Also available in: Atom PDF

Like0
Like0