Created
August 16, 2016 06:29
-
-
Save zotherstupidguy/8a8df04b1c9810d9bfb9ac4ff39c40fa to your computer and use it in GitHub Desktop.
building frameworks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module SSD | |
| def self.included base | |
| base.send :include, InstanceMethods | |
| base.extend ClassMethods | |
| end | |
| module InstanceMethods | |
| def print | |
| p "hello world from SSD" | |
| end | |
| end | |
| module ClassMethods | |
| def mass | |
| p "this is mass print" | |
| end | |
| end | |
| end | |
| class Framework | |
| def self.inherited(model) | |
| model.send :include, SSD | |
| model.extend SSD | |
| end end | |
| class App < Framework | |
| end | |
| app = App.new | |
| app.print | |
| App.mass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment