tags:

views:

72

answers:

1

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?

+1  A: 

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.

rubiii
yeah module_function class methods are public but instance methods are private
banister