Ruby 1.9.3 リファレンスマニュアル > ライブラリ一覧 > 組み込みライブラリ > BasicObjectクラス > singleton_method_removed (private)

instance method BasicObject#singleton_method_removed

singleton_method_removed(name) -> object

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

通常のメソッドの削除に対するフックには Module#method_removedを使います。

[PARAM] name:
削除されたメソッド名が Symbol で渡されます。
class Foo
  def singleton_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_ALSO] Module#method_removed,BasicObject#singleton_method_added,BasicObject#singleton_method_undefined

class BasicObject