44件ヒット
[1-44件を表示]
(0.052秒)
別のキーワード
クラス
- BasicObject (33)
- Module (11)
キーワード
検索結果
先頭4件
-
Module
# method _ undefined(name) -> () (18256.0) -
このモジュールのインスタンスメソッド name が Module#undef_method によって削除されるか、 undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。
... name が
Module#undef_method によって削除されるか、
undef 文により未定義にされると、インタプリタがこのメソッドを呼び出します。
特異メソッドの削除をフックするには
BasicObject#singleton_method_undefined
を使います。
@param name 削......除/未定義にされたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class C
def C.method_undefined(name)
puts "method C\##{name} was undefined"
end
def foo
end
def bar
end
undef_method :foo
undef bar
end
//}
実行結果:
method C#foo was undefine... -
BasicObject
# singleton _ method _ undefined(name) -> object (6252.0) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...義に対するフックには
Module#method_undefined を使います。
@param name 未定義にされたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Fo......foo
end
def obj.bar
end
class << obj
undef_method :foo
end
obj.instance_eval {undef bar}
#=> singleton method "foo" was undefined
# singleton method "bar" was undefined
//}
@see Module#method_undefined,BasicObject#singleton_method_added,BasicObject#singleton_method_removed , d:spec/def#undef... -
BasicObject
# singleton _ method _ added(name) -> object (139.0) -
特異メソッドが追加された時にインタプリタから呼び出されます。
...ます。
@param name 追加されたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_added(name)
puts "singleton method \"#{name}\" was added"
end
end
obj = Foo.new
def obj.foo
end
#=> singleton method "foo" was added
//}
@see Module#m......ethod_added,BasicObject#singleton_method_removed,BasicObject#singleton_method_undefined... -
BasicObject
# singleton _ method _ removed(name) -> object (139.0) -
特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。
...るフックには
Module#method_removedを使います。
@param name 削除されたメソッド名が Symbol で渡されます。
//emlist[例][ruby]{
class Foo
def singleton_method_removed(name)
puts "singleton method \"#{name}\" was removed"
end
end
obj = Foo.new
def obj.foo
end
cl......ass << obj
remove_method :foo
end
#=> singleton method "foo" was removed
//}
@see Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_method_undefined...