るりまサーチ

最速Rubyリファレンスマニュアル検索!
24件ヒット [1-24件を表示] (0.018秒)

別のキーワード

  1. arguable options
  2. arguable order!
  3. arguable permute!
  4. arguable options=

ライブラリ

モジュール

検索結果

OptionParser::Arguable#getopts(short_opt, *long_opt) -> Hash (21107.0)

指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。

...:ParseError のサブク
ラスの例外になります。

//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"...

optparse (24.0)

コマンドラインのオプションを取り扱うためのライブラリです。

...ARGV に OptionParser::Arguable の機能
が加わります。以下の書き方ができるようになります。
OptionParser::Arguable#getopts はオプションを保持した Hash を返します。

//emlist[sample.rb][ruby]{
require 'optparse'
params = ARGV.getopts("a:b:", "foo", "bar:")...