finalist 0.1.1 → 0.1.2
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/README.md +1 -1
- data/lib/finalist.rb +9 -27
- data/lib/finalist/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1236d1165f3b66a96e58dc3cd1a6f99ae1c15886b01f4e18804f956b04a9b4a
|
4
|
+
data.tar.gz: 1d2040be22e0ed1583983666af88983b4fd9d5a133f6d3ade05fe3c3af7b00a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8432ac5cd98ec972e93651107ee468dbfb96e6304a637650d48694c4484f6c421c575774d4c4f2def446c5eb8425aa3e73785dd93962b3aa5fd649df13f91b30
|
7
|
+
data.tar.gz: d10d99046717352b9d09983c3b1ec487a95fd7b67491336f7c2e8f27041318af8465cd56b1dede419ca0f13e101d7212de2b372d7c95d118b41055cf0a06a0bb
|
data/README.md
CHANGED
@@ -183,7 +183,7 @@ end
|
|
183
183
|
|
184
184
|
## How is this implemented?
|
185
185
|
|
186
|
-
Use so many ruby hooks. `
|
186
|
+
Use so many ruby hooks. `method_added` and `singleton_method_added` and `included` and `extended`.
|
187
187
|
|
188
188
|
## Development
|
189
189
|
|
data/lib/finalist.rb
CHANGED
@@ -39,29 +39,20 @@ module Finalist
|
|
39
39
|
:end
|
40
40
|
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
base.
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
if Finalist.finalized_methods[super_method.owner]&.member?(super_method.name)
|
50
|
-
tp.disable
|
51
|
-
base.instance_variable_set("@__finalist_tp", nil)
|
52
|
-
raise OverrideFinalMethodError.new("#{super_method} at #{super_method.source_location.join(":")} is overrided\n by #{meth} at #{meth.source_location.join(":")}", base, super_method.owner, meth, :trace_point)
|
53
|
-
end
|
54
|
-
|
55
|
-
super_method = super_method.super_method
|
56
|
-
end
|
42
|
+
base.ancestors.drop(1).each do |mod|
|
43
|
+
Finalist.finalized_methods[mod]&.each do |fmeth_name|
|
44
|
+
if meth = base.instance_method(fmeth_name)
|
45
|
+
super_method = meth.super_method
|
46
|
+
while super_method
|
47
|
+
if Finalist.finalized_methods[super_method.owner]&.member?(super_method.name)
|
48
|
+
raise OverrideFinalMethodError.new("#{super_method} at #{super_method.source_location.join(":")} is overrided\n by #{meth} at #{meth.source_location.join(":")}", base, super_method.owner, meth, :included)
|
57
49
|
end
|
50
|
+
|
51
|
+
super_method = super_method.super_method
|
58
52
|
end
|
59
53
|
end
|
60
|
-
tp.disable
|
61
54
|
end
|
62
55
|
end
|
63
|
-
tp.enable
|
64
|
-
base.instance_variable_set("@__finalist_tp", tp)
|
65
56
|
end
|
66
57
|
|
67
58
|
def extended(base)
|
@@ -72,8 +63,6 @@ module Finalist
|
|
72
63
|
super_method = meth.super_method
|
73
64
|
while super_method
|
74
65
|
if Finalist.finalized_methods[super_method.owner]&.member?(super_method.name)
|
75
|
-
@__finalist_tp&.disable
|
76
|
-
@__finalist_tp = nil
|
77
66
|
raise OverrideFinalMethodError.new("#{super_method} at #{super_method.source_location.join(":")} is overrided\n by #{meth} at #{meth.source_location.join(":")}", singleton_class, super_method.owner, meth, :extended_singleton_method_added)
|
78
67
|
end
|
79
68
|
super_method = super_method.super_method
|
@@ -86,9 +75,6 @@ module Finalist
|
|
86
75
|
super_method = meth.super_method
|
87
76
|
while super_method
|
88
77
|
if Finalist.finalized_methods[super_method.owner]&.member?(super_method.name)
|
89
|
-
base.instance_variable_get("@__finalist_tp")&.disable
|
90
|
-
base.instance_variable_set("@__finalist_tp", nil)
|
91
|
-
|
92
78
|
raise OverrideFinalMethodError.new("#{super_method} at #{super_method.source_location.join(":")} is overrided\n by #{meth} at #{meth.source_location.join(":")}", base.singleton_class, super_method.owner, meth, :extended)
|
93
79
|
end
|
94
80
|
super_method = super_method.super_method
|
@@ -113,8 +99,6 @@ module Finalist
|
|
113
99
|
super_method = meth.super_method
|
114
100
|
while super_method
|
115
101
|
if Finalist.finalized_methods[super_method.owner]&.member?(super_method.name)
|
116
|
-
@__finalist_tp&.disable
|
117
|
-
@__finalist_tp = nil
|
118
102
|
raise OverrideFinalMethodError.new("#{super_method} at #{super_method.source_location.join(":")} is overrided\n by #{meth} at #{meth.source_location.join(":")}", self, super_method.owner, meth, :method_added)
|
119
103
|
end
|
120
104
|
super_method = super_method.super_method
|
@@ -128,8 +112,6 @@ module Finalist
|
|
128
112
|
super_method = meth.super_method
|
129
113
|
while super_method
|
130
114
|
if Finalist.finalized_methods[super_method.owner]&.member?(super_method.name)
|
131
|
-
@__finalist_tp&.disable
|
132
|
-
@__finalist_tp = nil
|
133
115
|
raise OverrideFinalMethodError.new("#{super_method} at #{super_method.source_location.join(":")} is overrided\n by #{meth} at #{meth.source_location.join(":")}", self, super_method.owner, meth, :singleton_method_added)
|
134
116
|
end
|
135
117
|
super_method = super_method.super_method
|
data/lib/finalist/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: finalist
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joker1007
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|