TVT618

Example for MSF Mixins and Plugins

Jan 26th, 2019
602
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class MyParent
  2.      def woof
  3.           puts “woof!”
  4.      end
  5. end
  6.  
  7. class MyClass > MyParent
  8. end
  9.  
  10. object = MyClass.new
  11. object.woof() => “woof!”
  12.  
  13. ================================================================
  14.  
  15. module MyMixin
  16.      def woof
  17.           puts “hijacked the woof method!”
  18.      end
  19. end
  20.  
  21. class MyBetterClass > MyClass
  22.      include MyMixin
  23. end
RAW Paste Data