OptionParser#on does not raise when klass and pat are given


#1

e$B$3$s$K$A$O!"e(Bsheepman e$B$G$9!#e(B

OptionParser#on e$B$K%/%i%9$H@55,I=8=$rF1;~$KM?$($F$b!“e(B
ArgumentError e$B$,H/@8$7$^$;$s!#e(B
e$B$=$l$8$c!”@55,I=8=$K%^%C%A$9$k%*%W%7%g%s$N0z?t$@$1e(B
e$BJQ49$7$F$/$l$k$N$+$H$$$&$H$=$&$G$b$J$$$h$&$G$9!#e(B

e$BNc30$rEj$2$k$+!“JQ49$9$k$+!”$I$A$i$+$r9T$C$?J}$,NI$$$H;W$$$^$9!#e(B

$ cat t.rb
require ‘optparse’
opts = OptionParser.new

opts.on(’-a A’, Array, /.{5}/){|v|
p v
}

opts.on(’-b A’, Array){|v|
p v
}

opts.parse(ARGV)

$ ruby-1.8 t.rb -a 1,2,3 -b 1,2,3
“1,2,3”
[“1”, “2”, “3”]

e$B>e$NNc$G$O!":G=i$Ne(B opts.on e$B$GNc30$,H/@8$9$k$+!"e(B
opts.parse e$B;~$K$A$c$s$HG[Ns$KJQ49$9$k$+$N$I$A$i$+$,e(B
e$BNI$$$N$G$O$H;W$$$^$9!#e(B