るりまサーチ

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

別のキーワード

  1. rbconfig ruby
  2. fiddle ruby_free
  3. fiddle build_ruby_platform
  4. rake ruby
  5. rubygems/defaults ruby_engine

ライブラリ

クラス

モジュール

キーワード

検索結果

<< 1 2 3 ... > >>

OptionParser#accept(klass, pat = /.*/) {|str| ...} -> () (18130.0)

OptionParser.accept と同様ですが、 登録したブロックはレシーバーに限定されます。

...Parser.accept と同様ですが、
登録したブロックはレシーバーに限定されます。

@param klass クラスオブジェクトを与えます。

@param pat match メソッドを持ったオブジェクト(Regexp オブジェクトなど)を与えます。

//emlist[例][ruby]{
req...
...uire "optparse"
require "time"

opts = OptionParser.new
opts.accept(Time) do |s,|
begin
Time.parse(s) if s
rescue
raise OptionParser::InvalidArgument, s
end
end

opts.on("-t", "--time [TIME]", Time) do |time|
p time.class # => Time
end

opts.parse!(ARGV)
//}...

Module#ruby2_keywords(method_name, ...) -> nil (6148.0)

For the given method names, marks the method as passing keywords through a normal argument splat. This should only be called on methods that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the method such that if the method is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the method to other methods.

...For the given method names, marks the method as passing keywords through
a normal argument splat. This should only be called on methods that
accept
an argument splat (`*args`) but not explicit keywords or a
keyword splat. It marks the method such that if the method is called
with keyword argument...
...ate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the module responds to this method befo...
...aware that if this method is removed, the behavior of the
method will change so that it does not pass through keywords.

//emlist[例][ruby]{
module Mod
def foo(meth, *args, &block)
send(:"do_#{meth}", *args, &block)
end
ruby
2_keywords(:foo) if respond_to?(:ruby2_keywords, true)
end
//}...

Proc#ruby2_keywords -> proc (6148.0)

Marks the proc as passing keywords through a normal argument splat. This should only be called on procs that accept an argument splat (`*args`) but not explicit keywords or a keyword splat. It marks the proc such that if the proc is called with keyword arguments, the final hash argument is marked with a special flag such that if it is the final element of a normal argument splat to another method call, and that method call does not include explicit keywords or a keyword splat, the final element is interpreted as keywords. In other words, keywords will be passed through the proc to other methods.

...Marks the proc as passing keywords through a normal argument splat. This
should only be called on procs that accept an argument splat (`*args`)
but not explicit keywords or a keyword splat. It marks the proc such
that if the proc is called with keyword arguments, the final hash
argument is marked...
...ate keywords to another
method, and only for backwards compatibility with Ruby versions before
2.7.

This method will probably be removed at some point, as it exists only
for backwards compatibility. As it does not exist in Ruby versions
before 2.7, check that the proc responds to this method before...
...so, be aware that if this method is removed, the behavior of the
proc will change so that it does not pass through keywords.

//emlist[][ruby]{
module Mod
foo = ->(meth, *args, &block) do
send(:"do_#{meth}", *args, &block)
end
foo.ruby2_keywords if foo.respond_to?(:ruby2_keywords)
end
//}...

OptionParser#on(long, klass = String, desc = "") {|v| ...} -> self (38.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...スを受け付けるかは、
以下の「デフォルトで利用可能な引数クラス」を参照して下さい。
OptionParser.accept や OptionParser#accept によって、受け付け
るクラスを増やすことができます。登録されていないクラスが指定された
場合...
...投げます。

オプションの引数は accept で登録したブロックで klass のインスタンス
に変換されてから、ブロックに渡されます。

opts.on("-w", "--width N", Integer){|w|
p w.class #=> Integer
}
# ruby command --width=32

opts.on("-o", "--overwri...

OptionParser#on(short, klass = String, desc = "") {|v| ...} -> self (38.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...スを受け付けるかは、
以下の「デフォルトで利用可能な引数クラス」を参照して下さい。
OptionParser.accept や OptionParser#accept によって、受け付け
るクラスを増やすことができます。登録されていないクラスが指定された
場合...
...投げます。

オプションの引数は accept で登録したブロックで klass のインスタンス
に変換されてから、ブロックに渡されます。

opts.on("-w", "--width N", Integer){|w|
p w.class #=> Integer
}
# ruby command --width=32

opts.on("-o", "--overwri...

絞り込み条件を変える

OptionParser#on(short, long, klass = String, desc = "") {|v| ...} -> self (38.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...スを受け付けるかは、
以下の「デフォルトで利用可能な引数クラス」を参照して下さい。
OptionParser.accept や OptionParser#accept によって、受け付け
るクラスを増やすことができます。登録されていないクラスが指定された
場合...
...投げます。

オプションの引数は accept で登録したブロックで klass のインスタンス
に変換されてから、ブロックに渡されます。

opts.on("-w", "--width N", Integer){|w|
p w.class #=> Integer
}
# ruby command --width=32

opts.on("-o", "--overwri...

OptionParser#on(long, pat = /.*/, desc = "") {|v| ...} -> self (33.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...dArgument が parse 実行時に投げられます。

opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error

@param short ショートオプションを表す文字列を指定します。

@param long ロン...

OptionParser#on(short, long, pat = /.*/, desc = "") {|v| ...} -> self (33.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...dArgument が parse 実行時に投げられます。

opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error

@param short ショートオプションを表す文字列を指定します。

@param long ロン...

OptionParser#on(short, pat = /.*/, desc = "") {|v| ...} -> self (33.0)

オプションを取り扱うためのブロックを自身に登録します。 ブロックはコマンドラインのパース時に、オプションが指定されていれば呼ばれます。

...dArgument が parse 実行時に投げられます。

opts.on("--username VALUE", /[a-zA-Z0-9_]+/){|name| ...}
# ruby command --username=ruby_user
# ruby command --username=ruby.user #=> Error

@param short ショートオプションを表す文字列を指定します。

@param long ロン...
<< 1 2 3 ... > >>