I have the following code:
class A
def self.scope
yield
end
def self.method_added method
self.instance_eval %{
# do something involving the added method
}
end
end
class B < A
scope do
def foo
end
end
end
When the method_added
hook is fired, will the code inside instance_eval
run within the same scope as the method that was added? Or, will it run outside of it?
What are the caveats and gotchas involved within this?