Skip to content

Instantly share code, notes, and snippets.

@unnu
Created January 31, 2012 13:35
Show Gist options
  • Save unnu/1710513 to your computer and use it in GitHub Desktop.
Save unnu/1710513 to your computer and use it in GitHub Desktop.
class A
def self.hello
p 'hello'
end
def class
(class << self; self; end)
end
end
module Foo
def bar
p 'bar'
end
end
a = A.new
b = A.new
a.instance_eval do
class << self
extend Foo
end
end
a.class.hello
a.class.bar
b.class.hello
b.class.bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment