Use singleton_method_added to call a singleton method : singleton_method_added « Reflection « Ruby
- Ruby
- Reflection
- singleton_method_added
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
Related examples in the same category