Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rosylilly/uninclude
Implement Module#uninclude and Object#unextend
https://github.com/rosylilly/uninclude
Last synced: 5 days ago
JSON representation
Implement Module#uninclude and Object#unextend
- Host: GitHub
- URL: https://github.com/rosylilly/uninclude
- Owner: rosylilly
- License: mit
- Created: 2013-03-17T18:25:22.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-10-07T07:45:33.000Z (about 9 years ago)
- Last Synced: 2024-12-22T13:14:58.643Z (15 days ago)
- Language: Ruby
- Homepage: https://rubygems.org/gems/uninclude
- Size: 328 KB
- Stars: 19
- Watchers: 4
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Uninclude
[![Gem Version](https://badge.fury.io/rb/uninclude.svg)](http://rubygems.org/gems/uninclude)
[![Build Status](https://travis-ci.org/rosylilly/uninclude.svg?branch=master)](https://travis-ci.org/rosylilly/uninclude)
[![Dependency Status](https://gemnasium.com/rosylilly/uninclude.svg)](https://gemnasium.com/rosylilly/uninclude)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
- REEsee [travis-ci.org](https://travis-ci.org/rosylilly/uninclude)
## Installation
Add this line to your application's Gemfile:
gem 'uninclude'
And then execute:
$ bundle
Or install it yourself as:
$ gem install uninclude
## Usage
```ruby
require 'uninclude'module Bar
endclass Foo
include Bar
endp 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.
```ruby
require 'uninclude/block' # This feature is optional. Please require 'uninclude/block' first.Foo.include(Bar) do
p Foo.ancestors # => [Foo, Bar, Object, Kernel, BasicObject]
endp 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