Guest User

Untitled

a guest
Jan 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. #!/usr/bin/ruby
  2.  
  3. module BaseModule
  4. def cry
  5. p "wa wa wa waaa"
  6. end
  7. end
  8.  
  9. module ExtendedModule
  10. include BaseModule
  11.  
  12. #override the cry method from BaseModule
  13. def cry
  14. super
  15. p "aa waa aa waa"
  16. end
  17. end
  18.  
  19. class MyClass
  20. include ExtendedModule
  21. end
  22.  
  23. MyClass.new.cry #=> wa wa wa waaa aa waa aa waa
Add Comment
Please, Sign In to add comment