extend self
and module_function
are two ruby ways to make it so you can call a method on a module and also call it if you include that module.
Are there any differences between the end results of those ways?
extend self
and module_function
are two ruby ways to make it so you can call a method on a module and also call it if you include that module.
Are there any differences between the end results of those ways?
module_function
makes the module's instance methods private, then duplicates and puts them into the module's metaclass. extend self
adds the module to the module's metaclass.