Skip to content

Instantly share code, notes, and snippets.

@thiagovsk
Created May 16, 2016 13:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thiagovsk/2ab318ed80ee31ceeea22c91f1216000 to your computer and use it in GitHub Desktop.
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
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