495件ヒット
[401-495件を表示]
(0.288秒)
種類
- インスタンスメソッド (418)
- 特異メソッド (66)
- クラス (11)
クラス
- OptionParser (484)
キーワード
- OptionParser (11)
- accept (22)
-
default
_ argv (11) -
default
_ argv= (11) - environment (11)
- getopts (44)
- help (11)
- load (11)
- new (22)
-
on
_ head (11) -
on
_ tail (11) - order (44)
- order! (22)
- parse (22)
- parse! (11)
- permute (22)
-
program
_ name (11) -
program
_ name= (11) - reject (22)
- release (11)
- separator (11)
-
summary
_ indent (11) -
summary
_ indent= (11) -
summary
_ width (11) -
summary
_ width= (11) -
to
_ a (11) -
to
_ s (11) - ver (11)
検索結果
先頭5件
-
OptionParser
# summarize(to = [] , width = self . summary _ width , max = width - 1 , indent= self . summary _ indent) {|line| . . . } -> () (3008.0) -
サマリを指定された to へと加えていきます。
...quire "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",... -
OptionParser
# summary _ indent -> String (3008.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_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", "......-h, --help\n"]
opts.summary_indent = " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ indent=(indent) (3008.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_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", "......-h, --help\n"]
opts.summary_indent = " " # => " "
opts.summary_indent # => " "
opts.summarize
# => [" -i, --init\n", " -u, --update\n", " -h, --help\n"]
//}... -
OptionParser
# summary _ width -> Integer (3008.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
# summary _ width=(width) (3008.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 # => 8
opts.summary_width # => 8
opts.summarize
# => [" -i\n", " --init\n", " -u\n", " --update\n", " -h\n", " --help\n"]
//}... -
OptionParser
# to _ a -> [String] (3008.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.to_a # => ["Usage: test [options]", " -i, --init\n", " -u, --update\n", " -h, --help... -
OptionParser
# to _ s -> String (3008.0) -
サマリの文字列を返します。
...emlist[例][ruby]{
require "optparse"
options = {}
opts = OptionParser.new do |opts|
opts.banner = "Usage: example.rb [options]"
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
options[:verbose] = v
end
end
puts opts.help
# => Usage: example.rb [options]
# -v, --[no-]verbose... -
OptionParser
# ver -> String (3008.0) -
program_name、version と release から生成したバージョンを表す文字列を返します。
...program_name、version と release から生成したバージョンを表す文字列を返します。
//emlist[例][ruby]{
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)"
exit
end
opts.parse!(ARGV)
end
//}... -
OptionParser
. accept(klass , pat = / . * / ) {|str| . . . } -> () (3008.0) -
オプションの引数を文字列から Ruby のオブジェクトに変換するための ブロックを登録します。すべての OptionParser インスタンスに共通です。
...ックを登録します。すべての OptionParser インスタンスに共通です。
ブロックには、文字列として与えられるオプションの引数から klass のインスタンスを生成して返すものを指定します。
OptionParser#on で klass を指定した場合......ら、OptionParser#on メソッドで登録したブロックに渡されます。
//emlist[][ruby]{
require "optparse"
require "time"
OptionParser.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end
opts = OptionParser.new
opts.on("-......Time
end
opts.parse!(ARGV)
//}
いくつかのクラスに対しては変換用のブロックがデフォルトで登録されて
います。OptionParser#on を参照して下さい。
@param klass クラスオブジェクトを与えます。
@param pat match メソッドを持ったオブ...