Issue #9887 has been updated by Nobuyoshi Nakada.

Duplicates Feature #8967: add uninclude and unextend method added

----------------------------------------
Feature #9887: Add uninclude please
https://bugs.ruby-lang.org/issues/9887#change-46989

* Author: Robert A. Heiler
* Status: Open
* Priority: Low
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
Hi!

I would like to have a way to cleanly uninclude a module.

Consider:

```ruby
module Foo
  TEST = '123'
end
class Bar
  include Foo
end
```

Now I would like to uninclude Foo. I can remove constants and methods already,
i.e. via `remove_method` or `undef`* and constants can be removed as well but
I would like to have something like:

~~~ruby
class Bar
  uninclude Foo
end
~~~

or

~~~ruby
Bar.uninclude Foo
Bar.remove_ancestors Foo
~~~

Would this be possible? It might be useful but perhaps there is a
reason why this can not be added.




-- 
https://bugs.ruby-lang.org/