Last active
May 17, 2016 14:33
-
-
Save Hirurg103/1d49d2839a28daf61e7f6d691536b7f6 to your computer and use it in GitHub Desktop.
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
class Concord1 < Module | |
def initialize | |
define_a | |
end | |
def define_a | |
puts self | |
define_method :a do | | | |
puts "a" | |
end | |
end | |
end | |
class C1 | |
mod = Concord1.new | |
puts mod.instance_methods.include? :a | |
include mod | |
end | |
C1.new.a =>? | |
class Concord2 < Module | |
def a | |
puts "a" | |
end | |
end | |
class C2 | |
mod = Concord2.new | |
puts mod.instance_methods.include? :a | |
include mod | |
end | |
C2.new.a => ? | |
class Concord3 < Module | |
define_method :a do | | | |
puts "a" | |
end | |
end | |
class C3 | |
include Concord3.new | |
end | |
C3.new.a => ? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment