o:$YARD::CodeObjects::MethodObject:
@name:undef_method:@docstringIC:YARD::Docstring"ïPrevents the current class from responding to calls to the named
method. Contrast this with remove_method
, which deletes
the method from the particular class; Ruby will still search
superclasses and mixed-in modules for a possible receiver.
class Parent
def hello
puts "In parent"
end
end
class Child < Parent
def hello
puts "In child"
end
end
c = Child.new
c.hello
class Child
remove_method :hello # remove from child, still in parent
end
c.hello
class Child
undef_method :hello # prevent any calls to 'hello'
end
c.hello
produces:
In child
In parent
prog.rb:23: undefined method `hello' for # (NoMethodError)
:@objectu:YARD::StubProxyModule#undef_method:
@summary0: @all"#Prevents the current class from responding to calls to the named
method. Contrast this with remove_method
, which deletes
the method from the particular class; Ruby will still search
superclasses and mixed-in modules for a possible receiver.
class Parent
def hello
puts "In parent"
end
end
class Child < Parent
def hello
puts "In child"
end
end
c = Child.new
c.hello
class Child
remove_method :hello # remove from child, still in parent
end
c.hello
class Child
undef_method :hello # prevent any calls to 'hello'
end
c.hello
produces:
In child
In parent
prog.rb:23: undefined method `hello' for # (NoMethodError)
@overload undef_method(symbol)
@return [Module]:@ref_tags[ :
@tags[o:YARD::Tags::OverloadTag
;
u;Module#undef_method;;;IC; "
;
u;Module#undef_method;0;
"@return [Module];[ ;[o:YARD::Tags::Tag
;
0;0:@types["Module:
@text" :@tag_name"return;0:@parameters[[:symbol0;0:@signature"undef_method(symbol);"
overload:@current_file_has_commentsF:@scope:
instance;[ :@docstring_extra0:@files[["eval.c0:@namespaceu;Module:
@path"Module#undef_method;[ :@visibility:public:@source"©/*
* call-seq:
* undef_method(symbol) => self
*
* Prevents the current class from responding to calls to the named
* method. Contrast this with remove_method
, which deletes
* the method from the particular class; Ruby will still search
* superclasses and mixed-in modules for a possible receiver.
*
* class Parent
* def hello
* puts "In parent"
* end
* end
* class Child < Parent
* def hello
* puts "In child"
* end
* end
*
*
* c = Child.new
* c.hello
*
*
* class Child
* remove_method :hello # remove from child, still in parent
* end
* c.hello
*
*
* class Child
* undef_method :hello # prevent any calls to 'hello'
* end
* c.hello
*
* produces:
*
* In child
* In parent
* prog.rb:23: undefined method `hello' for # (NoMethodError)
*/
static VALUE
rb_mod_undef_method(argc, argv, mod)
int argc;
VALUE *argv;
VALUE mod;
{
int i;
for (i=0; i