Created
October 9, 2015 14:18
-
-
Save gil27/7c6fc38b1ab48d794bd2 to your computer and use it in GitHub Desktop.
playing around with modules
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 Gil | |
def self.included(base) | |
base.extend ClassMethods | |
base.include InstanceMethods | |
end | |
module ClassMethods | |
def roles *args | |
ancestors.first | |
end | |
end | |
module InstanceMethods | |
end | |
end | |
class Gomes | |
include Gil | |
roles :admin | |
end | |
puts Gomes.roles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment