Skip to content

Instantly share code, notes, and snippets.

@gil27
Created October 9, 2015 14:18
Show Gist options
  • Save gil27/7c6fc38b1ab48d794bd2 to your computer and use it in GitHub Desktop.
Save gil27/7c6fc38b1ab48d794bd2 to your computer and use it in GitHub Desktop.
playing around with modules
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