るりまサーチ

最速Rubyリファレンスマニュアル検索!
12件ヒット [1-12件を表示] (0.099秒)
トップページ > クエリ:ruby[x] > 種類:インスタンスメソッド[x] > クエリ:-[x] > クエリ:r[x] > クエリ:regexp[x] > クラス:OptionParser[x]

別のキーワード

  1. _builtin -
  2. open-uri open
  3. irb/input-method gets
  4. irb/input-method new
  5. matrix -

ライブラリ

検索結果

OptionParser#accept(klass, pat = /.*/) {|str| ...} -> () (3214.0)

OptionParser.accept と同様ですが、 登録したブロックはレシーバーに限定されます。

...
OptionParser
.accept と同様ですが、
登録したブロックはレシーバーに限定されます。

@param klass クラスオブジェクトを与えます。

@param pat match メソッドを持ったオブジェクト(Regexp オブジェクトなど)を与えます。

//emlist[例][rub...
...y]{
r
equire "optparse"
r
equire "time"

opts = OptionParser.new
opts.accept(Time) do |s,|
begin
Time.parse(s) if s
r
escue
r
aise OptionParser::InvalidArgument, s
end
end

opts.on("-t", "--time [TIME]", Time) do |time|
p time.class # => Time
end

opts.parse!(ARGV)
//}...