unmixer 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -0
- data/README.md +15 -0
- data/Rakefile +0 -0
- data/lib/unmixer/core_refine.rb +31 -0
- data/lib/unmixer/version.rb +1 -1
- data/unmixer.gemspec +0 -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: 17de322e27c0481e6f4a01bbc24c2247dd7771da
|
4
|
+
data.tar.gz: 45b65725b8f6ce33623e2e9507ac39ce006f0db2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bd8c72bdd08c7c94573e8f381fd3fa1a5a009dcbaa5f495d2e109a5698a66e0877f4a8ffb91ce4cc9781d446b12fff53c6d3071cc2d733acdb2b8654942cd68
|
7
|
+
data.tar.gz: cc6b744028efcb738dc579add15c44bf3181e97d0caf213a1ac4ad18be7b3dbd4346fd1911d0e026c47e414b4e8e1ecc1894a16dd6aa4611535c82706179c77a
|
data/Gemfile
CHANGED
File without changes
|
data/README.md
CHANGED
@@ -44,17 +44,23 @@ p X.ancestors
|
|
44
44
|
X.instance_eval { uninclude M1 }
|
45
45
|
p X.ancestors
|
46
46
|
# => [M2, X, Object, Kernel, BasicObject]
|
47
|
+
p X.ancestors.include? M1
|
48
|
+
# => false
|
47
49
|
|
48
50
|
# Not remove prepend module. #uninclude is only include modules.
|
49
51
|
X.instance_eval { uninclude M2 }
|
50
52
|
p X.ancestors
|
51
53
|
# => [M2, X, Object, Kernel, BasicObject]
|
54
|
+
p X.ancestors.include? M2
|
55
|
+
# => true
|
52
56
|
|
53
57
|
|
54
58
|
# Remove prepend module.
|
55
59
|
X.instance_eval { unprepend M2 }
|
56
60
|
p X.ancestors
|
57
61
|
# => [X, Object, Kernel, BasicObject]
|
62
|
+
p X.ancestors.include? M2
|
63
|
+
# => false
|
58
64
|
|
59
65
|
|
60
66
|
X.extend M3
|
@@ -65,6 +71,8 @@ p X.singleton_class.ancestors
|
|
65
71
|
X.unextend M3
|
66
72
|
p X.singleton_class.ancestors
|
67
73
|
# => [#<Class:X>, #<Class:Object>, #<Class:BasicObject>, Class, Module, Object, Kernel, BasicObject]
|
74
|
+
p X.singleton_class.ancestors.include? M3
|
75
|
+
# => false
|
68
76
|
|
69
77
|
|
70
78
|
# #extend with block
|
@@ -75,6 +83,9 @@ X.extend M1 do
|
|
75
83
|
end
|
76
84
|
p X.singleton_class.ancestors
|
77
85
|
# => [#<Class:X>, #<Class:Object>, #<Class:BasicObject>, Class, Module, Object, Kernel, BasicObject]
|
86
|
+
p X.singleton_class.ancestors.include? M1
|
87
|
+
# => false
|
88
|
+
|
78
89
|
```
|
79
90
|
|
80
91
|
## Development
|
@@ -90,6 +101,10 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/osyo-m
|
|
90
101
|
|
91
102
|
## Release Note
|
92
103
|
|
104
|
+
#### 0.4.0
|
105
|
+
|
106
|
+
* Add `#include`/`#prepend` with block.
|
107
|
+
|
93
108
|
#### 0.3.0
|
94
109
|
|
95
110
|
* Fix accessibility `#unmixin`/`#uninclude`/`#unprepend` to public.
|
data/Rakefile
CHANGED
File without changes
|
data/lib/unmixer/core_refine.rb
CHANGED
@@ -10,6 +10,22 @@ module Unmixer
|
|
10
10
|
end
|
11
11
|
alias_method :uninclude, :unmixer_uninclude
|
12
12
|
|
13
|
+
alias_method :unmixer_original_include, :include
|
14
|
+
def unmixer_include mod
|
15
|
+
unmixer_original_include mod
|
16
|
+
|
17
|
+
if block_given?
|
18
|
+
begin
|
19
|
+
yield(self)
|
20
|
+
ensure
|
21
|
+
unmixer_uninclude mod
|
22
|
+
end
|
23
|
+
end
|
24
|
+
self
|
25
|
+
end
|
26
|
+
alias_method :include, :unmixer_include
|
27
|
+
|
28
|
+
|
13
29
|
def unmixer_unprepend mod
|
14
30
|
return self unless ancestors.tap { |it| break it[0, it.find_index(self)] }.include? mod
|
15
31
|
unmixer_unmixin mod
|
@@ -24,6 +40,21 @@ module Unmixer
|
|
24
40
|
self
|
25
41
|
end
|
26
42
|
alias_method :unprepend, :unmixer_unprepend
|
43
|
+
|
44
|
+
alias_method :unmixer_original_prepend, :prepend
|
45
|
+
def unmixer_prepend mod
|
46
|
+
unmixer_original_prepend mod
|
47
|
+
|
48
|
+
if block_given?
|
49
|
+
begin
|
50
|
+
yield(self)
|
51
|
+
ensure
|
52
|
+
unmixer_unprepend mod
|
53
|
+
end
|
54
|
+
end
|
55
|
+
self
|
56
|
+
end
|
57
|
+
alias_method :prepend, :unmixer_prepend
|
27
58
|
end
|
28
59
|
|
29
60
|
refine Object do
|
data/lib/unmixer/version.rb
CHANGED
data/unmixer.gemspec
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unmixer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- manga_osyo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
requirements: []
|
114
114
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.6.
|
115
|
+
rubygems_version: 2.6.13
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Remove mixin modules.
|