invisible 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/invisible.rb +8 -2
- data/lib/invisible/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72e65a804434aaa0d8ab2ffd43ac25e1d21cd9ece36ada09cc1182386c07e1d6
|
4
|
+
data.tar.gz: e1379dff0e06e556fa0fa015416a4a6d598b58bf3442dc13d14aaeb676dc5f8b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 25eee1664224d7e3f1ef82943cdf421f77b8859d4d4a3dc6c5dc370398297556cf84ea7c9be3ea04a2b4a165b5ed03d51bec85fa3e8783eb5afade47207617cf
|
7
|
+
data.tar.gz: 52173c2d4870367147ef495117703cbcc23f7dd29c110d8f4eab7b551f4eb5f07bfa19eec798d41b7a583110dc2c4dfff71252fa506cf40d7743dd9f2ea0f17b
|
data/CHANGELOG.md
CHANGED
@@ -2,21 +2,25 @@
|
|
2
2
|
|
3
3
|
## 0.2
|
4
4
|
|
5
|
-
### 0.2.
|
5
|
+
### 0.2.3 (October 30, 2019)
|
6
|
+
|
7
|
+
* Only prepend dup'ed module once if possible ([#5](https://github.com/shioyama/invisible/pull/5))
|
8
|
+
|
9
|
+
### 0.2.2 (October 30, 2019)
|
6
10
|
|
7
11
|
* Give a name to prepended module. ([#4](https://github.com/shioyama/invisible/pull/4))
|
8
12
|
|
9
|
-
### 0.2.1
|
13
|
+
### 0.2.1 (October 30, 2019)
|
10
14
|
|
11
15
|
* Change name of attribute accessor in prepended module to `invisible`.
|
12
16
|
([#3](https://github.com/shioyama/invisible/pull/3))
|
13
17
|
|
14
|
-
### 0.2.0
|
18
|
+
### 0.2.0 (October 29, 2019)
|
15
19
|
|
16
20
|
* Add support for `prepend`. ([#2](https://github.com/shioyama/invisible/pull/2))
|
17
21
|
|
18
22
|
## 0.1
|
19
23
|
|
20
|
-
### 0.1.0
|
24
|
+
### 0.1.0 (October 29, 2019)
|
21
25
|
|
22
26
|
* Support for `include`.
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
Public? Private? Protected? Who cares! I just wanna monkey patch that shit!
|
10
10
|
|
11
|
-
No fear: Invisible has your back! This little
|
11
|
+
No fear: Invisible has your back! This little gem does away with the problem of maintaining original method visibility, so you can get on with your monkey-patching mayhem. It does this with only a dozen lines of code.
|
12
12
|
|
13
13
|
## Usage
|
14
14
|
|
data/lib/invisible.rb
CHANGED
@@ -74,9 +74,15 @@ maintain their original visibility.
|
|
74
74
|
def prepend_features(base)
|
75
75
|
return super if invisible
|
76
76
|
|
77
|
-
|
77
|
+
mod = dup
|
78
|
+
|
79
|
+
if name
|
80
|
+
return if base.const_defined?(mod_name = "Invisible#{name}")
|
81
|
+
base.const_set(mod_name, mod)
|
82
|
+
end
|
83
|
+
|
84
|
+
sync_visibility(base, mod)
|
78
85
|
mod.invisible = true
|
79
|
-
base.const_set("Invisible#{name}", mod) if base.name && name
|
80
86
|
base.prepend mod
|
81
87
|
end
|
82
88
|
|
data/lib/invisible/version.rb
CHANGED