uninclude 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -1
- data/README.md +6 -5
- data/ext/uninclude/uninclude.c +1 -0
- data/lib/uninclude/version.rb +1 -1
- data/spec/uninclude_spec.rb +27 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f79263459ef7fa7277c158219544f3aea224485
|
4
|
+
data.tar.gz: 28000a08eb75952fa64bbee0a8b5cef0fbca6e42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe90ab8dae54b66dce47c424f0f7a670490acf81ff18402abc3eed7be827da559851f788e513afbd8639de470c15aa0544050df5c0b3ef51b8a76dfabe3e2018
|
7
|
+
data.tar.gz: 80890fe920c38978abbc006eac479a1aa28c50643a474e2458d21f87ecc75d76fc64509cc9a1e3d988c59b79373b6161ed227605eefbea600278d2638f297679
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
# Uninclude
|
2
2
|
|
3
|
-
[![Gem Version](https://badge.fury.io/rb/uninclude.
|
4
|
-
[![Build Status](https://travis-ci.org/rosylilly/uninclude.
|
5
|
-
[![Dependency Status](https://gemnasium.com/rosylilly/uninclude.
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/uninclude.svg)](http://rubygems.org/gems/uninclude)
|
4
|
+
[![Build Status](https://travis-ci.org/rosylilly/uninclude.svg?branch=master)](https://travis-ci.org/rosylilly/uninclude)
|
5
|
+
[![Dependency Status](https://gemnasium.com/rosylilly/uninclude.svg)](https://gemnasium.com/rosylilly/uninclude)
|
6
6
|
|
7
7
|
Implement Module#uninclude and Object#unextend
|
8
8
|
|
9
9
|
## Tested ruby versions
|
10
10
|
|
11
|
-
- 2.
|
12
|
-
- 2.1.
|
11
|
+
- 2.2.0
|
12
|
+
- 2.1.4
|
13
|
+
- 2.1.0
|
13
14
|
- 2.0.0
|
14
15
|
- 1.9.3
|
15
16
|
- 1.9.2
|
data/ext/uninclude/uninclude.c
CHANGED
@@ -47,5 +47,6 @@ static VALUE rb_m_unextend(VALUE self, VALUE mod) {
|
|
47
47
|
|
48
48
|
void Init_uninclude(void) {
|
49
49
|
rb_define_private_method(rb_cModule, "uninclude", RUBY_METHOD_FUNC(rb_m_uninclude), 1);
|
50
|
+
rb_define_private_method(rb_cModule, "unprepend", RUBY_METHOD_FUNC(rb_m_uninclude), 1);
|
50
51
|
rb_define_method(rb_cObject, "unextend", RUBY_METHOD_FUNC(rb_m_unextend), 1);
|
51
52
|
}
|
data/lib/uninclude/version.rb
CHANGED
data/spec/uninclude_spec.rb
CHANGED
@@ -8,6 +8,13 @@ end
|
|
8
8
|
describe Uninclude do
|
9
9
|
let(:klass) {
|
10
10
|
Class.new do
|
11
|
+
if respond_to_missing?(:singleton_class, true)
|
12
|
+
def singleton_class
|
13
|
+
class << self
|
14
|
+
self
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
11
18
|
end
|
12
19
|
}
|
13
20
|
let(:instance) { klass.new }
|
@@ -16,8 +23,11 @@ describe Uninclude do
|
|
16
23
|
it 'should uninclude module' do
|
17
24
|
klass.class_eval { include ExampleMod }
|
18
25
|
expect(instance).to respond_to(:mod)
|
26
|
+
expect(instance.mod).to equal(:mod)
|
27
|
+
expect(klass.ancestors).to include(ExampleMod)
|
19
28
|
klass.class_eval { uninclude ExampleMod }
|
20
29
|
expect(instance).to_not respond_to(:mod)
|
30
|
+
expect(klass.ancestors).to_not include(ExampleMod)
|
21
31
|
end
|
22
32
|
|
23
33
|
it 'should not infinite loop' do
|
@@ -25,12 +35,29 @@ describe Uninclude do
|
|
25
35
|
end
|
26
36
|
end
|
27
37
|
|
38
|
+
if Module.respond_to?(:prepend)
|
39
|
+
describe '.unprepend' do
|
40
|
+
it 'should unprepend module' do
|
41
|
+
klass.class_eval { prepend ExampleMod }
|
42
|
+
expect(instance).to respond_to(:mod)
|
43
|
+
expect(instance.mod).to equal(:mod)
|
44
|
+
expect(klass.ancestors).to include(ExampleMod)
|
45
|
+
klass.class_eval { unprepend ExampleMod }
|
46
|
+
expect(instance).to_not respond_to(:mod)
|
47
|
+
expect(klass.ancestors).to_not include(ExampleMod)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
28
52
|
describe '#unextend' do
|
29
53
|
it 'should unextend module' do
|
30
54
|
instance.extend(ExampleMod)
|
31
55
|
expect(instance).to respond_to(:mod)
|
56
|
+
expect(instance.mod).to equal(:mod)
|
57
|
+
expect(instance.singleton_class.ancestors).to include(ExampleMod)
|
32
58
|
instance.unextend(ExampleMod)
|
33
59
|
expect(instance).to_not respond_to(:mod)
|
60
|
+
expect(instance.singleton_class.ancestors).to_not include(ExampleMod)
|
34
61
|
end
|
35
62
|
end
|
36
63
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uninclude
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sho Kusano
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
requirements: []
|
96
96
|
rubyforge_project:
|
97
|
-
rubygems_version: 2.4.
|
97
|
+
rubygems_version: 2.4.5
|
98
98
|
signing_key:
|
99
99
|
specification_version: 4
|
100
100
|
summary: Implement Module#uninclude and Object#unextend
|