Can anyone elaborate on the differences between ruby’s Object#define_method and Module#define_method and where they are generally used?
Can anyone elaborate on the differences between ruby’s Object#define_method and Module#define_method and where they
Share
Object#define_methoddoes not exist:However,
Object.define_methodexists:That’s because
Objectis an object of classClass, andClassis a subclass ofModule:So when you call
Object.define_method, you’re callingModule#define_method.Just remember that classes are objects of class
Class, and it’ll be as clear as mud!