るりまサーチ

最速Rubyリファレンスマニュアル検索!
6319件ヒット [1-100件を表示] (0.046秒)
トップページ > クエリ:method[x] > クエリ:Method[x]

別のキーワード

  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 ... > >>

Method (44176.0)

Object#method によりオブジェクト化され たメソッドオブジェクトのクラスです。

...ject#method によりオブジェクト化され
たメソッドオブジェクトのクラスです。

メソッドの実体(名前でなく)とレシーバの組を封入します。
Proc オブジェクトと違ってコンテキストを保持しません。

=== Proc との差

Method
...
...は使い捨てに向き、Method は何度も繰り返し生成する
場合に向くと言えます。また内包するコードの大きさという点では
Proc は小規模、Method は大規模コードに向くと言えます。


既存のメソッドを Method オブジェクト化する...
...

//emlist[例][ruby]{
class Foo
def foo(arg)
"foo called with arg #{arg}"
end
end

m = Foo.new.method(:foo)

p m # => #<Method: Foo#foo>
p m.call(1) # => "foo called with arg 1"
//}

名前のないメソッド(の代わり)が必要なら Proc を使うと良い。

//em...

Method#super_method -> Method | nil (42556.0)

self 内で super を実行した際に実行されるメソッドを Method オブジェ クトにして返します。

...るメソッドを Method オブジェ
クトにして返します。

@see UnboundMethod#super_method

//emlist[例][ruby]{
class Super
def foo
"superclass method"
end
end

class Sub < Super
def foo
"subclass method"
end
end

m = Sub.new.method(:foo) # => #<Method: Sub#foo>
m.call #...
...=> "subclass method"
m.super_method # => #<Method: Super#foo>
m.super_method.call # => "superclass method"
//}...

static VALUE method_arity(VALUE method) (32400.0)

static VALUE method_call(int argc, VALUE *argv, VALUE method) (32400.0)

static VALUE method_eq(VALUE method, VALUE other) (32400.0)

絞り込み条件を変える

static VALUE method_inspect(VALUE method) (32400.0)

static VALUE method_proc(VALUE method) (32400.0)

static VALUE method_clone(VALUE self) (32200.0)

static VALUE method_list(VALUE mod, int option, int (*func)()) (32200.0)

モジュール mod に定義されているメソッドに対して 順番に func を繰り返し呼び出します。

モジュール mod に定義されているメソッドに対して
順番に func を繰り返し呼び出します。
<< 1 2 3 ... > >>