Created
June 20, 2022 15:22
-
-
Save HooFoo/3ee911e071b963f15c1d02890ebccd3f to your computer and use it in GitHub Desktop.
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
| require 'singleton' | |
| module MySingleton | |
| def self.included(base) | |
| base.class_eval { include Singleton } | |
| end | |
| def mymethod | |
| p 'Helo World' | |
| end | |
| end | |
| module MySingleton2 | |
| def self.included(base) | |
| include Singleton | |
| end | |
| def mymethod | |
| p 'Helo World' | |
| end | |
| end | |
| class A | |
| include MySingleton | |
| end | |
| class B | |
| include MySingleton2 | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment