Skip to content

Instantly share code, notes, and snippets.

@Hirurg103
Last active May 17, 2016 14:33
Show Gist options
  • Save Hirurg103/1d49d2839a28daf61e7f6d691536b7f6 to your computer and use it in GitHub Desktop.
Save Hirurg103/1d49d2839a28daf61e7f6d691536b7f6 to your computer and use it in GitHub Desktop.
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