るりまサーチ (Ruby 2.2.0)

最速Rubyリファレンスマニュアル検索!
5件ヒット [1-5件を表示] (0.010秒)
トップページ > クラス:Method[x] > バージョン:2.2.0[x] > クエリ:unboundmethod[x]

別のキーワード

  1. _builtin unboundmethod
  2. unboundmethod ==
  3. unboundmethod bind
  4. unboundmethod to_s
  5. unboundmethod name

ライブラリ

キーワード

検索結果

Method#unbind -> UnboundMethod (373.0)

self のレシーバとの関連を取り除いた UnboundMethod オブ ジェクトを生成して返します。

...いた UnboundMethod オブ
ジェクトを生成して返します。

//emlist[例][ruby]{
class Foo
def foo
"foo"
end
end

m = Foo.new.method(:foo) # => #<Method: Foo#foo>
unbound_method = m.unbind # => #<UnboundMethod: Foo#foo>
unbound_method.bind(Foo.new) # => #<Method: Foo#foo>
//}...

Method#inspect -> String (40.0)

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

...します。

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

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

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュ...
...モジュール名、
method
は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}

klass...
...が同じ場合は以下の形式になります。
#<Method: klass1#method> (形式2)

特異メソッドに対しては、
#<Method: obj.method> (形式3)
#<Method: klass1(klass2).method> (形式4)
という形式の文字列...

Method#to_s -> String (40.0)

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

...します。

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

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

klass1 は、Method#inspect では、レシーバのクラス名、
UnboundMethod#inspect では、UnboundMethod オブジェクトの生成
元となったクラス/モジュ...
...モジュール名、
method
は、メソッド名を表します。

//emlist[例][ruby]{
module Foo
def foo
"foo"
end
end
class Bar
include Foo
def bar
end
end

p Bar.new.method(:foo) # => #<Method: Bar(Foo)#foo>
p Bar.new.method(:bar) # => #<Method: Bar#bar>
//}

klass...
...が同じ場合は以下の形式になります。
#<Method: klass1#method> (形式2)

特異メソッドに対しては、
#<Method: obj.method> (形式3)
#<Method: klass1(klass2).method> (形式4)
という形式の文字列...

Method#original_name -> Symbol (22.0)

オリジナルのメソッド名を返します。

...オリジナルのメソッド名を返します。

//emlist[例][ruby]{
class C
def foo; end
alias bar foo
end
C.new.method(:bar).original_name # => :foo
//}

@see UnboundMethod#original_name...

Method#super_method -> Method | nil (22.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"
//}...

絞り込み条件を変える