[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: How do you "undef_method" for a class method?

Xavier Noria

7/22/2007 5:55:00 PM

El Jul 22, 2007, a las 6:44 PM, Dean Wampler escribió:

> Module#undef_method and Module#remove_method work fine for instance
> methods,
> but if you specify a class method, your get an error that it
> doesn't exist.
> (I'm using ruby 1.8.6.)

You need to get into the singleton class:

(class << Foo; self; end).send(:remove_method, :method)

-- fxn


2 Answers

dblack

7/22/2007 7:29:00 PM

0

dblack

7/23/2007 1:49:00 PM

0