るりまサーチ

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

別のキーワード

  1. _builtin new
  2. _builtin inspect
  3. _builtin []
  4. _builtin to_s
  5. _builtin each

クラス

モジュール

キーワード

検索結果

<< 1 2 > >>

Object#send(name, *args) -> object (26306.0)

オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。

...ジェクトのメソッド name を args を引数に
して呼び出し、メソッドの実行結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

send
が再定義された場合に備えて別名 __send__ も
用意されており...
..._send__ は再定義すべきではありません。

send
, __send__ は、メソッドの呼び出し制限
にかかわらず任意のメソッドを呼び出せます。
d:spec/def#limit も参照してください。

public メソッドだけ呼び出せれば良い場合は
Object#public_send...
...を使う方が良いでしょう。

@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッドに渡す引数です。

//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"


class Foo
def foo() "foo" end
def bar()...

Object#send(name, *args) { .... } -> object (26306.0)

オブジェクトのメソッド name を args を引数に して呼び出し、メソッドの実行結果を返します。

...ジェクトのメソッド name を args を引数に
して呼び出し、メソッドの実行結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

send
が再定義された場合に備えて別名 __send__ も
用意されており...
..._send__ は再定義すべきではありません。

send
, __send__ は、メソッドの呼び出し制限
にかかわらず任意のメソッドを呼び出せます。
d:spec/def#limit も参照してください。

public メソッドだけ呼び出せれば良い場合は
Object#public_send...
...を使う方が良いでしょう。

@param name 文字列かSymbol で指定するメソッド名です。
@param args 呼び出すメソッドに渡す引数です。

//emlist[][ruby]{
p -365.send(:abs) #=> 365
p "ruby".send(:sub,/./,"R") #=> "Ruby"


class Foo
def foo() "foo" end
def bar()...

BasicObject#__send__(name, *args) -> object (14276.0)

オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。

...オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

@param name 呼び出すメソッドの名前。 Symbol または文字列で指定し...
...nd
def send(name, *args)
"(Mail#send) - #{name} #{args.join(',')}"
end
end
mail = Mail.new
mail.send :delete, "gentle", "readers" # => "(Mail#send) - delete gentle,readers"
mail.__send__ :delete, "gentle", "readers" # => "(Mail#delete) - delete gentle,readers"
//}

@see Object#send...

BasicObject#__send__(name, *args) { .... } -> object (14276.0)

オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。

...オブジェクトのメソッド name を args を引数にして呼び出し、メソッドの結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

@param name 呼び出すメソッドの名前。 Symbol または文字列で指定し...
...nd
def send(name, *args)
"(Mail#send) - #{name} #{args.join(',')}"
end
end
mail = Mail.new
mail.send :delete, "gentle", "readers" # => "(Mail#send) - delete gentle,readers"
mail.__send__ :delete, "gentle", "readers" # => "(Mail#delete) - delete gentle,readers"
//}

@see Object#send...

Object#public_send(name, *args) -> object (14258.0)

オブジェクトの public メソッド name を args を引数にして呼び出し、メソッ ドの実行結果を返します。

...の public メソッド name を args を引数にして呼び出し、メソッ
ドの実行結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

//emlist[][ruby]{
1.public_send(:+, 2) # => 3
//}

@param name 文字列かSymbol で指...
...or name を指定しなかった場合に発生します。

@raise NoMethodError protected メソッドや private メソッドに対して実行
した場合に発生します。

//emlist[][ruby]{
1.public_send(:puts, "hello") # => NoMethodError
//}

@see BasicObject#__send_...
..._, Object#send...

絞り込み条件を変える

Object#public_send(name, *args) { .... } -> object (14258.0)

オブジェクトの public メソッド name を args を引数にして呼び出し、メソッ ドの実行結果を返します。

...の public メソッド name を args を引数にして呼び出し、メソッ
ドの実行結果を返します。

ブロック付きで呼ばれたときはブロックもそのまま引き渡します。

//emlist[][ruby]{
1.public_send(:+, 2) # => 3
//}

@param name 文字列かSymbol で指...
...or name を指定しなかった場合に発生します。

@raise NoMethodError protected メソッドや private メソッドに対して実行
した場合に発生します。

//emlist[][ruby]{
1.public_send(:puts, "hello") # => NoMethodError
//}

@see BasicObject#__send_...
..._, Object#send...

Object#method(name) -> Method (8137.0)

オブジェクトのメソッド name をオブジェクト化した Method オブジェクトを返します。

...オブジェクトのメソッド name をオブジェクト化した
Method オブジェクトを返します。

@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します。

//em...
...list[][ruby]{
me = -365.method(:abs)
p me #=> #<Method: Integer#abs>
p me.call #=> 365
//}

@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#singleton_method...

Object#singleton_method(name) -> Method (8137.0)

オブジェクトの特異メソッド name をオブジェクト化した Method オブ ジェクトを返します。

...オブジェクトの特異メソッド name をオブジェクト化した Method オブ
ジェクトを返します。

@param name メソッド名をSymbol またはStringで指定します。
@raise NameError 定義されていないメソッド名を引数として与えると発生します...
...o.new(99)
def k.hi
"Hi, @iv = #{@iv}"
end
m = k.singleton_method(:hi) # => #<Method: #<Demo:0xf8b0c3c4 @iv=99>.hi>
m.call #=> "Hi, @iv = 99"
m = k.singleton_method(:hello) # => NameError
//}

@see Module#instance_method, Method, BasicObject#__send__, Object#send, Kernel.#eval, Object#method...

Object#public_method(name) -> Method (8131.0)

オブジェクトの public メソッド name をオブジェクト化した Method オブジェクトを返します。

...オブジェクトの public メソッド name をオブジェクト化した
Method オブジェクトを返します。

@param name メソッド名を Symbol または String で指定します。
@raise NameError 定義されていないメソッド名や、
protected メソッド名、...
...vate メソッド名を引数として与えると発生します。

//emlist[][ruby]{
1.public_method(:to_int) #=> #<Method: Integer#to_int>
1.public_method(:p) # method `p' for class `Integer' is private (NameError)
//}

@see Object#method,Object#public_send,Module#public_instance_method...

Module#ruby2_keywords(method_name, ...) -> nil (8109.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...
...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
ruby2_keywords(:foo) if respond_to?(:ruby2_keywords, true)
end
//}...

絞り込み条件を変える

<< 1 2 > >>