9件ヒット
[1-9件を表示]
(0.017秒)
ライブラリ
- ビルトイン (9)
キーワード
検索結果
先頭3件
-
Object
# singleton _ method _ undefined(name) -> object (18108) -
特異メソッドが Module#undef_method または undef により未定義にされた時にインタプリタから呼び出されます。
...d_undefined を使います。
@param name 未定義にされたメソッド名が Symbol で渡されます。
class Foo
def singleton_method_undefined(name)
puts "singleton method \"#{name}\" was undefined"
end
end
obj = Foo.new
def obj.foo
end
def ob.......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,Object#singleton_method_added,Object#singleton_method_removed , d:spec/def#undef... -
Object
# singleton _ method _ added(name) -> object (7) -
特異メソッドが追加された時にインタプリタから呼び出されます。
...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,Object#singleton_method_removed,Object#singleton_method_undefined... -
Object
# singleton _ method _ removed(name) -> object (7) -
特異メソッドが Module#remove_method に より削除された時にインタプリタから呼び出されます。
...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,Object#singleton_method_added,Object#singleton_method_undefined...
