るりまサーチ

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

別のキーワード

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

検索結果

Module#method_added(name) -> () (26116.0)

メソッド name が追加された時にインタプリタがこのメソッドを呼び出します。

...ッドの追加に対するフックには
BasicObject#singleton_method_added
を使います。

@param name 追加されたメソッドの名前が Symbol で渡されます。

//emlist[例][ruby]{
class Foo
def Foo.method_added(name)
puts "method \"#{name}\" was added"
end

def foo
e...

BasicObject#singleton_method_added(name) -> object (14122.0)

特異メソッドが追加された時にインタプリタから呼び出されます。

...通常のメソッドの追加に対するフックには
Module#method_addedを使います。

@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#method_added,BasicObject#singleton_method_removed,BasicObject#singleton_method_undefined...

BasicObject#singleton_method_removed(name) -> object (8009.0)

特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。

...method_removed(name)
puts "singleton method \"#{name}\" was removed"
end
end

obj = Foo.new
def obj.foo
end

class << obj
remove_method :foo
end

#=> singleton method "foo" was removed
//}

@see Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_method_undefined...

BasicObject#singleton_method_undefined(name) -> object (8009.0)

特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。

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