o:$YARD::CodeObjects::MethodObject:@visibility:private:@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)
:@line_rangeo:
Range: exclT:endit:
beginiL:@ref_tags[ :@unresolved_reference0:
@summary0:@hash_flagF: @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 [self]:@objectu:YARD::StubProxyModule#undef_method:
@tags[o:YARD::Tags::OverloadTag
;IC; " ;[ ;0;0;F;u;Module#undef_method;"@return [self];[o:YARD::Tags::Tag
:
@name0;0:@types[" self:
@text" :@tag_name"return:@parameters[["symbol0;:undef_method;u;Module#undef_method;0;0:@signature"undef_method(symbol);"
overload;[ :@files[["eval.ciw:@source_type0;;:@namespaceu;Module:@current_file_has_commentsT:@scope:
instance:
@path"Module#undef_method:@docstrings{ ;"static VALUE:@module_functionF;[ :@source"@static VALUE
rb_mod_undef_method(argc, argv, mod)
int argc;