Created
May 16, 2016 13:36
-
-
Save thiagovsk/2ab318ed80ee31ceeea22c91f1216000 to your computer and use it in GitHub Desktop.
criando modulo sendo incluido na classe como metodo de instancia e de classe
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 Foo | |
def self.included base | |
base.send :include, InstanceMethods | |
base.extend ClassMethods | |
end | |
module InstanceMethods | |
def bar1 | |
'bar1' | |
end | |
end | |
module ClassMethods | |
def bar2 | |
'bar2' | |
end | |
end | |
end | |
class Test | |
include Foo | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment