Created
August 12, 2011 15:02
-
-
Save smsohan/1142228 to your computer and use it in GitHub Desktop.
Listing all mixed in classes of a module
This file contains 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 MyModule | |
def self.included base | |
included_classes << base unless included_classes.include?(base) | |
end | |
def self.included_classes | |
@@included ||= [] | |
end | |
end | |
class ClassA | |
include MyModule | |
end | |
class ClassB | |
include MyModule | |
end | |
puts MyModule.included_classes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment