781件ヒット
[1-100件を表示]
(0.113秒)
種類
- インスタンスメソッド (693)
- 特異メソッド (77)
- クラス (11)
クラス
- OptionParser (594)
-
OptionParser
:: ParseError (99)
モジュール
キーワード
- OptionParser (11)
- accept (22)
- args (11)
-
default
_ argv (11) - environment (11)
-
filter
_ backtrace (11) - getopts (55)
- help (11)
- inspect (11)
- load (11)
- new (22)
- on (132)
-
on
_ head (11) -
on
_ tail (11) - order (44)
- order! (44)
- parse (22)
- parse! (22)
- permute (22)
- permute! (22)
-
program
_ name (11) - reason (11)
- recover (11)
- reject (22)
- release (11)
- separator (11)
-
set
_ backtrace (11) -
set
_ option (11) - summarize (22)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
to
_ a (11) -
to
_ s (22) - ver (11)
- version (11)
検索結果
先頭5件
- OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () - OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () - OptionParser
# summary _ indent -> String - OptionParser
# summary _ width -> Integer - OptionParser
:: Arguable # getopts(short _ opt , *long _ opt) -> Hash
-
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) -> () (140.0) -
サマリを指定された to へと加えていきます。
..."optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10, 8, " ")
# => ["description\n", " -i......\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}... -
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () (140.0) -
サマリを指定された to へと加えていきます。
..."optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summarize(["description\n"], 10, 8, " ")
# => ["description\n", " -i......\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}... -
OptionParser
# summary _ indent -> String (138.0) -
サマリを表示する時のインデントを文字列で返します。
...t[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_i......ndent = " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ width -> Integer (138.0) -
サマリを表示するときの幅を整数で返します。
...emlist[例][ruby]{
require "optparse"
opts = OptionParser.new do |opts|
opts.on_head("-i", "--init")
opts.on("-u", "--update")
opts.on_tail("-h", "--help")
end
opts.summary_width # => 32
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
opts.summary_width......= 8
opts.summary_width # =>8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}... -
OptionParser
:: Arguable # getopts(short _ opt , *long _ opt) -> Hash (138.0) -
指定された short_opt や long_opt に応じて自身をパースし、結果を Hash として返します。
...返します。
コマンドラインに - もしくは -- を指定した場合、それ以降の解析を行ないません。
@param short_opt ショートネームのオプション(-f や -fx)を文字列で指定します。オプションが -f と -x の
2つの場合は "......オプションが引数をとる場合は直後に ":" を付けます。
@param long_opt ロングネームのオプション(--version や --bufsize=512)を文字列で指定をします。
オプションが引数をとる場合は後ろに ":" を付けます。......ラスの例外になります。
//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"=>... -
OptionParser
# on(long , *rest) {|v| . . . } -> self (129.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...説明と見なします。
//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http
opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}... -
OptionParser
# on(short , *rest) {|v| . . . } -> self (129.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...説明と見なします。
//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http
opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}... -
OptionParser
# on(short , long , *rest) {|v| . . . } -> self (129.0) -
オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。
...説明と見なします。
//emlist[][ruby]{
opts.on("--protocol VALUE", [:http, :ftp, :https]){|w|
p w
}
# ruby command --protocol=http #=> :http
opts.on("-c", "--charset VALUE", {"jis" => "iso-2022-jp", "sjis" => "shift_jis"}){|w|
p w
}
# ruby command --charset=jis #=> "iso-2022-jp"
//}... -
OptionParser
# release -> String (126.0) -
プログラムのリリースを文字列で返します。
...プログラムのリリースを文字列で返します。
//emlist[例][ruby]{
require "optparse"
OptionParser.new do |opts|
opts.release # => nil
opts.release = "2019-05-01"
opts.release # => "2019-05-01"
end
//}... -
OptionParser
# ver -> String (126.0) -
program_name、version と release から生成したバージョンを表す文字列を返します。
...require "optparse"
OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"
opts.program_name = "Optparse Example"
opts.version = [0, 1]
opts.release = "2019-05-01"
opts.on_tail("--version", "Show version") do
puts opts.ver # => "Optparse Example 0.1 (2019-05-01)"...