るりまサーチ (Ruby 2.4.0)

最速Rubyリファレンスマニュアル検索!
5件ヒット [1-5件を表示] (0.080秒)
トップページ > バージョン:2.4.0[x] > ライブラリ:ビルトイン[x] > クエリ:p[x] > クエリ:self[x] > クエリ:class[x] > クエリ:UnboundMethod[x]

別のキーワード

  1. object yield_self
  2. _builtin yield_self
  3. _builtin self
  4. tracepoint self
  5. codeobject document_self=

クラス

キーワード

検索結果

UnboundMethod (114205.0)

レシーバを持たないメソッドを表すクラスです。 呼び出すためにはレシーバにバインドする必要があります。

レシーバを持たないメソッドを表すクラスです。
呼び出すためにはレシーバにバインドする必要があります。

Module#instance_method や
Method#unbind により生成し、後で
UnboundMethod#bind によりレシーバを
割り当てた Method オブジェクトを作ることができます。

//emlist[例: Method クラスの冒頭にある例を UnboundMethod で書くと以下のようになります。][ruby]{
class Foo
def foo() "foo" end
def bar() "bar" end
def baz() "baz...

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

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

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


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

@raise TypeError objがbindできないオブジェクトである場合に発生します

//emlist[例][ruby]{
# クラスのインスタンスメソッドの UnboundMethod の場合
class Foo
def foo
"foo"
end
end

# UnboundMethod `m' を生...

Method#inspect -> String (18589.0)

self を読みやすい文字列として返します。

self を読みやすい文字列として返します。

以下の形式の文字列を返します。

#<Method: klass1(klass2)#method> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2 は、実際にそのメソッドを定義しているクラス/モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def...

Method#super_method -> Method | nil (18409.0)

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

self 内で super を実行した際に実行されるメソッドを 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 me...

Method#to_s -> String (9289.0)

self を読みやすい文字列として返します。

self を読みやすい文字列として返します。

以下の形式の文字列を返します。

#<Method: klass1(klass2)#method> (形式1)

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュール名です。

klass2 は、実際にそのメソッドを定義しているクラス/モジュール名、
method は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def...

絞り込み条件を変える