SHARE
TWEET

Example for MSF Mixins and Plugins

TVT618 Jan 26th, 2019 433 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top