Mega Code Archive

 
Categories / Ruby / Reflection
 

Use singleton_method_added to call a singleton method

class MyClass   def MyClass.singleton_method_added(sym)     puts "Added method #{sym.id2name} to class MyClass."   end   def MyClass.meth1     puts "I'm meth1."   end end def MyClass.meth2   puts "And I'm meth2." end