robgleeson/mixit — Issue #5: Call 'cleanup!' on mixed-in modules.
Author: robgleeson
Created: 2011-11-24 22:43:27+00:00
State: open

Right now we're removing instance variables that are added after a scope has been extended magically, but we don't plan well for this type of scenario:

```ruby
class Example
def initialize
end

def bar
@bar = 'foo'
end
end

Mixit.temporarily Foo, Example.new do
bar
end
```

If `Example#bar` were to be called while a scope has been extended, the `@bar` variable would be removed when the scope is being unextended. So, instead, we'll leave it up to the author of the mixed-in module to remove any state they know they've set by passing the receiver onto a `#cleanup!`method.