Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module A
- def hello
- puts "hola"
- end
- end
- # Instead of module_function, let's include A in its own metaclass so we
- # can both include the methods in other classes and call the methods a class methods of the module
- module A
- class << self
- include ::A
- end
- end
- class B
- include A
- end
- A.hello # => "hola"
- B.new.hello # => "hola"
Add Comment
Please, Sign In to add comment