def and undef a method
Jul 25
2008
2008
Comments Off
def my_method; end # define a method undef my_method # remove a method
my web space
def my_method; end # define a method undef my_method # remove a method
Perl
package MyClass; package main; *MyClass::from_my_class = sub { print "defined in ", __PACKAGE__, "\n" }; MyClass::from_my_class();
Ruby
class String def self.from_string print "defined in " + self.name + $/ end end String::from_string String. from_string