invisible 0.2.2 → 0.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 42402a14ea7331574c6464e25cb2f943a415cb5e9d02e55f697a636299a77858
4
- data.tar.gz: 45917af86719513324f74903070e9e4e81400f717ae9d3ff0d0b1e6c3c258116
3
+ metadata.gz: 72e65a804434aaa0d8ab2ffd43ac25e1d21cd9ece36ada09cc1182386c07e1d6
4
+ data.tar.gz: e1379dff0e06e556fa0fa015416a4a6d598b58bf3442dc13d14aaeb676dc5f8b
5
5
  SHA512:
6
- metadata.gz: 7f34308289596d38fac511fc27d4f421b651766607b3abbc4472cbeb82c54d0661ba16b7c09b197db0b1371b948bf9a78ac4fb5599d4a1e0898fc179350457d0
7
- data.tar.gz: 1c3dcc2f68785c6dc65585957c4f8faed9e57088fec55ad888bf26cb0f2585a8ada6079294debbb79c5f5ec52ed9990e46ea0a2dc5132ad416ebee3002ca5810
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.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
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- invisible (0.2.1)
4
+ invisible (0.2.2)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 ten-line gem does away with the problem of maintaining original method visibility, so you can get on with your monkey-patching mayhem.
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
- sync_visibility(base, mod = dup)
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
 
@@ -1,3 +1,3 @@
1
1
  module Invisible
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invisible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg