るりまサーチ

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

別のキーワード

  1. irb/input-method gets
  2. irb/input-method new
  3. _builtin define_method
  4. irb/input-method encoding
  5. irb/input-method readable_atfer_eof?

ライブラリ

モジュール

検索結果

<< < 1 2 3 4 > >>

OpenSSL::SSL::SSLContext#tmp_dh_callback=(cb) (6107.0)

一時的 DH 鍵を生成するためのコールバックを設定します。

...一時的 DH 鍵を生成するためのコールバックを設定します。

コールバックには Proc や Method を渡します。

暗号で一時的な DH 鍵を利用する場合にはこのコールバックが
呼びだされ、呼びだされたブロックは適切な鍵パラメー...
...れで返されるオブジェクトはパラメータしか
用いられません。

cb に nil を指定するとデフォルトのパラメータが利用されます。

デフォルト値は nil です。

@param cb 設定するコールバック
@see OpenSSL::SSL::SSLContext#tmp_dh_callback...

OpenSSL::SSL::SSLContext#verify_callback=(proc) (6107.0)

検証をフィルタするコールバックを設定します。

...検証をフィルタするコールバックを設定します。

OpenSSL::X509::Store#verify_callback= と同じ働きをします。

コールバックには Proc や Method を渡します。

渡されたコールバックオブジェクトは証明書チェインの検証時に
チェイン...
...nil を設定するとデフォルトのコールバック(単に第一引数をそのまま返すだけ)
が使われます。

初期状態は nil です。

@param proc 設定する Proc オブジェクト
@see OpenSSL::SSL::SSLContext#verify_callback,
OpenSSL::X509::Store#verify_callback=...

OpenSSL::X509::Store#verify_callback=(proc) (6107.0)

検証をフィルタするコールバックを設定します。

...検証をフィルタするコールバックを設定します。

コールバックには Proc や Method を渡します。

渡されたコールバックオブジェクトは証明書チェインの検証時に
チェインに含まれる各証明書の署名を検証するたびに呼びだ...
...ォルトのコールバック(単に第一引数をそのまま返すだけ)
が使われます。

初期状態は nil です。

@param proc 設定する Proc オブジェクト
@see OpenSSL::X509::Store#verify_callback,
OpenSSL::X509::Store#verify,
OpenSSL::X509::StoreContext#verify...

UnboundMethod#bind(obj) -> Method (3172.0)

self を obj にバインドした Method オブジェクトを生成して返します。

...self を obj にバインドした Method オブジェクトを生成して返します。


@param obj 自身をバインドしたいオブジェクトを指定します。ただしバインドできるのは、
生成元のクラスかそのサブクラスのインスタンスのみで...
...UnboundMethod の場合
class Foo
def foo
"foo"
end
end

# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Foo#foo>

# Foo のインスタンスをレシーバとする Method オブジェクトを生成
p m.bind(Foo.new) # => #<Method: Foo#fo...
... Method
class Bar < Foo
end
p m.bind(Bar.new) # => #<Method: Bar(Foo)#foo>


# モジュールのインスタンスメソッドの UnboundMethod の場合
module Foo
def foo
"foo"
end
end

# UnboundMethod `m' を生成
p m = Foo.instance_method(:foo) # => #<UnboundMethod: Fo...

Module#ruby2_keywords(method_name, ...) -> nil (276.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...
...other 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.

This should only be used for methods that delegate keywords to another
method
, an...
....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 before calling
it. Also, be aware that if this method is removed, the behavior of the
method
will ch...

絞り込み条件を変える

Proc#<<(callable) -> Proc (155.0)

self と引数を合成した Proc を返します。

...、まず受け取った引数を callable に渡して呼び出し、
その戻り値を self に渡して呼び出した結果を返します。

Proc#>> とは呼び出しの順序が逆になります。

@param callable Proc、Method、もしくは任意の call メソッドを持ったオブ...
...][ruby]{
f = proc { |x| x * x }
g = proc { |x| x + x }

# (3 + 3) * (3 + 3)
p (f << g).call(3) # => 36
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hell...
...o, Ruby!
TEXT

pipeline = proc { |data| puts "word count: #{data.size}" } << WordScanner << File.method(:read)
pipeline.call('testfile') # => word count: 4
//}

@see Method#<<, Method#>>...

Proc#>>(callable) -> Proc (155.0)

self と引数を合成した Proc を返します。

...数を self に渡して呼び出し、
その戻り値を callable に渡して呼び出した結果を返します。

Proc#<< とは呼び出しの順序が逆になります。

@param callable Proc、Method、もしくは任意の call メソッドを持ったオブジェクト。

//emlist[例...
...).call(3) # => 18
//}

//emlist[call を定義したオブジェクトを渡す例][ruby]{
class WordScanner
def self.call(str)
str.scan(/\w+/)
end
end

File.write('testfile', <<~TEXT)
Hello, World!
Hello, Ruby!
TEXT

pipeline = proc { |fname| File.read(fname) } >> WordScanner >> method(...
...:p)
pipeline.call('testfile') # => ["Hello", "World", "Hello", "Ruby"]
//}

@see Method#<<, Method#>>...

MiniTest::Assertions#assert_respond_to(object, method_name, message = nil) -> true (114.0)

与えられたオブジェクトが与えられたメソッドを持つ場合、検査にパスしたことになります。

...トを指定します。

@param method_name メソッド名を指定します。

@param message 検査に失敗した場合に表示するメッセージを指定します。
文字列か Proc を指定します。Proc である場合は Proc#call した
結果を使...

Proc#ruby2_keywords -> proc (89.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.

...oc 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 specia...
...nother 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.

This should only be used for procs that delegate keywords to another
method
, and...
...by 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 calling
it. Also, be aware that if this method is removed, the behavior of...

Proc#lambda? -> bool (61.0)

手続きオブジェクトの引数の取扱が厳密であるならば true を返します。

...である場合
# 余分な引数を無視する
proc{|a,b| [a,b]}.call(1,2,3) # => [1,2]
# 足りない引数には nil が渡される
proc{|a,b| [a,b]}.call(1) # => [1, nil]
# 配列1つだと展開される
proc{|a,b| [a,b]}.call([1,2]) # => [1,2]
# lambdaの場合これらはすべて ArgumentE...
...#=> false

# Method#to_proc によるものは lambda?が真となる
def m() end
method
(:m).to_proc.lambda? #=> true

# Module#define_method は特別扱いで、
# これで定義されたメソッドの引数は常に厳密に取り扱われる
class C
define_method(:d) {}
end
C.new.d(...
...1,2) #=> ArgumentError
C.new.method(:d).to_proc.lambda? #=> true

class C
define_method(:e, &proc {})
end
C.new.e(1,2) #=> ArgumentError
C.new.method(:e).to_proc.lambda? #=> true
//}...

絞り込み条件を変える

TracePoint#parameters -> [object] (47.0)

現在のフックが属するメソッドまたはブロックのパラメータ定義を返します。 フォーマットは Method#parameters と同じです。

... Method#parameters と同じです。

@raise RuntimeError :call、:return、:b_call、:b_return、:c_call、:c_return
イベントのためのイベントフックの外側で実行した場合に発生します。

//emlist[例][ruby]{
def foo(a, b = 2)
end
TracePoint.new(:call...
...) do |tp|
p tp.parameters # => a], [:opt, :b
end.enable do
foo(1)
end
//}

@see Method#parameters, UnboundMethod#parameters, Proc#parameters...

BasicObject#instance_eval {|obj| ... } -> object (31.0)

オブジェクトのコンテキストで文字列 expr またはオブジェクト自身をブロックパラメータとするブロックを 評価してその結果を返します。

...きに
初めて instance_eval 内のメソッドが定義されます。これはメソッド定義のネストと同じです。
d:spec/def#nest_method を参照してください。

BasicObject を継承して作ったクラス内で instance_eval する場合はトップレベルの定数や Ke...
...unknown (RuntimeError)
//}

//emlist[例][ruby]{
class Bar < BasicObject
def call1
instance_eval("::ENV.class")
end
def call2
instance_eval("ENV.class")
end
end

bar = Bar.new
bar.call1 # => Object
bar.call2 # raise NameError
//}

@see Module#module_eval, Kernel.#eval, BasicObject#in...
<< < 1 2 3 4 > >>