Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/ruby
- module BaseModule
- def cry
- p "wa wa wa waaa"
- end
- end
- module ExtendedModule
- include BaseModule
- #override the cry method from BaseModule
- def cry
- super
- p "aa waa aa waa"
- end
- end
- class MyClass
- include ExtendedModule
- end
- MyClass.new.cry #=> wa wa wa waaa aa waa aa waa
Add Comment
Please, Sign In to add comment