るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.016秒)
トップページ > クエリ:Hash[x] > バージョン:2.3.0[x] > ライブラリ:optparse[x] > モジュール:OptionParser::Arguable[x]

別のキーワード

  1. _builtin hash
  2. hash []
  3. dbm to_hash
  4. matrix hash
  5. _builtin to_hash

検索結果

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

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

...実際は OptionParser::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"=>...