Skip to content

Instantly share code, notes, and snippets.

@JunKikuchi
Created June 1, 2009 03:34
Show Gist options
  • Save JunKikuchi/121214 to your computer and use it in GitHub Desktop.
Save JunKikuchi/121214 to your computer and use it in GitHub Desktop.
class A
def initialize(a, &block)
a.instance_variables.each do |var|
instance_variable_set(var, a.instance_variable_get(var))
end
instance_eval(&block)
end
def aaa
p :aaa
end
end
@a = 0
instance_eval do
@a = 1
@b = 2
@c = 3
A.new(self) do
p [@a, @b, @c]
aaa
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment