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