invisible 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec6e3dc7bce460129f162a4d86d209e6bcb60465cbed9a27cdd72be8ab39a153
4
- data.tar.gz: bb55e63585517a844219039697c213e419d408a6d38faee9edcd9fd164824d52
3
+ metadata.gz: eb5436fd22665d78914881fb0c67242b305ec088048ac2a6ef7d3a424b99451b
4
+ data.tar.gz: 939c02f69fe6c083315363b6c46531c92b0f5fd74a90421937d886ec0ad452b2
5
5
  SHA512:
6
- metadata.gz: c7c27b7f1ac6b9f10f0c62129fa61361c526f07a780263dc5e0d2b64579baa025542002354094b405ad3913dad07aba26809f188619ecf307a3d6cdbe962e52f
7
- data.tar.gz: a0fc24dd164097118d0a214e5004ec84d26ae5686ad5cd465f5b00ccb2911f9232890550e7d8b5d4c6e16404f0a64d7080302439ed0f50f36f365cf8a0b3d84b
6
+ metadata.gz: d670cc9bedf47de871c96abce0715ac2dbf057beb98df0240683f775a3bc18a0c0e2be91d447ed3891373b3c4fa72c599b228e11b28f49d95c3c4d11112c8975
7
+ data.tar.gz: 307886f9fc44e83688718d29d931fd63a75a9f5425ae34da3e3a35e9c93949cf87e98e2ee12144e2af12cf5a3af8b9492fc469010212fffb5ef25ae944b5504f
@@ -0,0 +1,18 @@
1
+ # Invisible Changelog
2
+
3
+ ## 0.2
4
+
5
+ ### 0.2.1
6
+
7
+ * Change name of attribute accessor in prepended module to `invisible`.
8
+ ([#3](https://github.com/shioyama/invisible/pull/3))
9
+
10
+ ### 0.2.0
11
+
12
+ * Add support for `prepend`. ([#2](https://github.com/shioyama/invisible/pull/2))
13
+
14
+ ## 0.1
15
+
16
+ ### 0.1.0
17
+
18
+ * Support for `include`.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- invisible (0.1.0)
4
+ invisible (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
  [gem]: https://rubygems.org/gems/invisible
7
7
  [travis]: https://travis-ci.com/shioyama/invisible
8
8
 
9
- Public? Private? Protected? Who cares! I just want to monkey patch that shit!
9
+ Public? Private? Protected? Who cares! I just wanna monkey patch that shit!
10
10
 
11
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.
12
12
 
@@ -39,19 +39,19 @@ end
39
39
  We don't want to care about whether the methods are private or whatever. So we define our module like so:
40
40
 
41
41
  ```ruby
42
- module Foo
42
+ module WithFoo
43
43
  extend Invisible
44
44
 
45
45
  def public_method
46
- super + 'foo'
46
+ super + ' with foo'
47
47
  end
48
48
 
49
49
  def protected_method
50
- super + 'foo'
50
+ super + ' with foo'
51
51
  end
52
52
 
53
53
  def private_method
54
- super + 'foo'
54
+ super + ' with foo'
55
55
  end
56
56
  end
57
57
  ```
@@ -60,38 +60,32 @@ Normally, without Invisible, we would have just made methods that were previousl
60
60
 
61
61
  ```ruby
62
62
  class MyClass < Base
63
- include Foo
63
+ include WithFoo
64
64
  end
65
65
 
66
66
  instance = MyClass.new
67
67
 
68
- instance.public_method_defined?(:public_method) #=> true
69
- instance.public_method #=> 'publicfoo'
68
+ MyClass.public_method_defined?(:public_method) #=> true
69
+ instance.public_method #=> 'public with foo'
70
70
 
71
- instance.protected_method_defined?(:protected_method) #=> true
72
- instance.protected_method # raises NoMethodError
73
- instance.send(:protected_method) #=> 'protectedfoo'
71
+ MyClass.protected_method_defined?(:protected_method) #=> true
72
+ instance.protected_method # raises NoMethodError
73
+ instance.send(:protected_method) #=> 'protected with foo'
74
74
 
75
- instance.private_method_defined?(:private_method) #=> true
76
- instance.private_method # raises NoMethodError
77
- instance.send(:private_method) #=> 'privatefoo'
75
+ MyClass.private_method_defined?(:private_method) #=> true
76
+ instance.private_method # raises NoMethodError
77
+ instance.send(:private_method) #=> 'private with foo'
78
78
  ```
79
79
 
80
80
  Also works with `prepend`:
81
81
 
82
82
  ```ruby
83
- class MyClass < Base
84
- prepend Foo
83
+ Base.prepend WithFoo
85
84
 
86
- private
87
- def private_method
88
- super + 'bar'
89
- end
90
- end
85
+ instance = Base.new
91
86
 
92
- instance = MyClass.new
93
- instance.private_method # raises NoMethodError
94
- instance.send(:private_method) #=> 'privatebarfoo'
87
+ Base.private_method_defined?(:private_method) # raises NoMethodError
88
+ instance.send(:private_method) #=> 'private with foo'
95
89
  ```
96
90
 
97
91
  ## License
@@ -6,7 +6,7 @@ module Invisible
6
6
  Extend any module with +Invisible+ and any methods the module overrides will
7
7
  maintain their original visibility.
8
8
 
9
- @example
9
+ @example With +include+
10
10
  class Base
11
11
  def public_method
12
12
  'public'
@@ -25,38 +25,46 @@ maintain their original visibility.
25
25
  end
26
26
  end
27
27
 
28
- module Foo
28
+ module WithFoo
29
29
  extend Invisible
30
30
 
31
31
  def public_method
32
- super + 'foo'
32
+ super + ' with foo'
33
33
  end
34
34
 
35
35
  def protected_method
36
- super + 'foo'
36
+ super + ' with foo'
37
37
  end
38
38
 
39
39
  def private_method
40
- super + 'foo'
40
+ super + ' with foo'
41
41
  end
42
42
  end
43
43
 
44
44
  class MyClass < Base
45
- include Foo
45
+ include WithFoo
46
46
  end
47
47
 
48
48
  instance = MyClass.new
49
49
 
50
- instance.public_method_defined?(:public_method) #=> true
51
- instance.public_method #=> 'publicfoo'
50
+ MyClass.public_method_defined?(:public_method) #=> true
51
+ instance.public_method #=> 'publicfoo'
52
52
 
53
- instance.protected_method_defined?(:protected_method) #=> true
54
- instance.protected_method # raises NoMethodError
55
- instance.send(:protected_method) #=> 'protectedfoo'
53
+ MyClass.protected_method_defined?(:protected_method) #=> true
54
+ instance.protected_method # raises NoMethodError
55
+ instance.send(:protected_method) #=> 'protectedfoo'
56
56
 
57
- instance.private_method_defined?(:private_method) #=> true
58
- instance.private_method # raises NoMethodError
59
- instance.send(:private_method) #=> 'privatefoo'
57
+ MyClass.private_method_defined?(:private_method) #=> true
58
+ instance.private_method # raises NoMethodError
59
+ instance.send(:private_method) #=> 'privatefoo'
60
+
61
+ @example With +prepend+
62
+ Base.prepend WithFoo
63
+
64
+ instance = Base.new
65
+
66
+ Base.private_method_defined?(:private_method) # raises NoMethodError
67
+ instance.send(:private_method) #=> 'private with foo'
60
68
 
61
69
  =end
62
70
  def append_features(base)
@@ -64,15 +72,15 @@ maintain their original visibility.
64
72
  end
65
73
 
66
74
  def prepend_features(base)
67
- return super if synced
75
+ return super if invisible
68
76
 
69
77
  sync_visibility(base, mod = dup)
70
- mod.synced = true
78
+ mod.invisible = true
71
79
  base.prepend mod
72
80
  end
73
81
 
74
82
  protected
75
- attr_accessor :synced
83
+ attr_accessor :invisible
76
84
 
77
85
  private
78
86
 
@@ -1,3 +1,3 @@
1
1
  module Invisible
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: invisible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Salzberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-29 00:00:00.000000000 Z
11
+ date: 2019-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -45,6 +45,7 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
+ - CHANGELOG.md
48
49
  - Gemfile
49
50
  - Gemfile.lock
50
51
  - Guardfile
@@ -52,7 +53,6 @@ files:
52
53
  - README.md
53
54
  - Rakefile
54
55
  - lib/invisible.rb
55
- - lib/invisible/CHANGELOG.md
56
56
  - lib/invisible/version.rb
57
57
  homepage: https://github.com/shioyama/invisible
58
58
  licenses:
@@ -60,6 +60,7 @@ licenses:
60
60
  metadata:
61
61
  homepage_uri: https://github.com/shioyama/invisible
62
62
  source_code_uri: https://github.com/shioyama/invisible
63
+ changelog_uri: https://github.com/shioyama/invisible/blob/master/CHANGELOG.md
63
64
  post_install_message:
64
65
  rdoc_options: []
65
66
  require_paths:
@@ -1,9 +0,0 @@
1
- # Invisible Changelog
2
-
3
- ## 0.2.0
4
-
5
- * Add support for `prepend`. ([#2](https://github.com/shioyama/invisible/pull/2))
6
-
7
- ## 0.1.0
8
-
9
- * Support for `include`.