Project

uninclude

0.01
No commit activity in last 3 years
No release in over 3 years
Implement Module#uninclude and Object#unextend
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
 Project Readme

Uninclude

Gem Version Build Status Dependency Status

Implement Module#uninclude and Object#unextend

Tested ruby versions

  • 2.2.3
  • 2.2.0
  • 2.1.4
  • 2.1.0
  • 2.0.0
  • 1.9.3
  • 1.9.2
  • 1.8.7
  • REE

see travis-ci.org

Installation

Add this line to your application's Gemfile:

gem 'uninclude'

And then execute:

$ bundle

Or install it yourself as:

$ gem install uninclude

Usage

require 'uninclude'

module Bar
end

class Foo
  include Bar
end

p Foo.ancestors # => [Foo, Bar, Object, Kernel, BasicObject]

Foo.class_eval { uninclude Bar }
p Foo.ancestors # => [Foo, Object, Kernel, BasicObject]

foo = Foo.new

foo.extend(Bar)
p foo.singleton_class.ancestors # => [Bar, Foo, Object, Kernel, BasicObject]

foo.unextend(Bar)
p foo.singleton_class.ancestors # => [Foo, Object, Kernel, BasicObject]

uninclude/block

Make #include / #uninclude accepts blocks.

require 'uninclude/block' # This feature is optional. Please require 'uninclude/block' first.

Foo.include(Bar) do
  p Foo.ancestors # => [Foo, Bar, Object, Kernel, BasicObject]
end

p Foo.ancestors # => [Foo, Object, Kernel, BasicObject]

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request