Skip to content

Instantly share code, notes, and snippets.

@serradura
Created May 25, 2018 07:35
Show Gist options
  • Save serradura/a521341187ef340b33f9347e9ff3596d to your computer and use it in GitHub Desktop.
Save serradura/a521341187ef340b33f9347e9ff3596d to your computer and use it in GitHub Desktop.
module Foo
A = 1
B = 2
def a1
A
end
def b1
B
end
end
module Bar
A = 3
B = 4
def a2
A
end
def b2
B
end
end
class Test
include Foo
include Bar
end
p Test.constants # => [:A, :B]
p Test.new.a1 # => 1
p Test.new.b1 # => 2
p Test.new.a2 # => 3
p Test.new.b2 # => 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment