11件ヒット
[1-11件を表示]
(0.086秒)
ライブラリ
- optparse (11)
モジュール
検索結果
-
OptionParser
:: Arguable # getopts(short _ opt , *long _ opt) -> Hash (25.0) -
指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。
...--bufsize=512)を文字列で指定をします。
オプションが引数をとる場合は後ろに ":" を付けます。
オプションの引数のデフォルト値を ":" の直後に指定することができます。
例えば、"bufsize:10......ります。
//emlist[t.rb][ruby]{
require 'optparse'
params = ARGV.getopts("ab:", "foo", "bar:", "bufsize:1024")
p params
//}
# 実行結果
$ ruby t.rb -b 1 --foo --bar xxx -- -a
{"bufsize"=>"1024", "a"=>false, "b"=>"1", "foo"=>true, "bar"=>"xxx"} # "a"=>false であることに注意。...