finalist 0.1.1 → 0.1.2

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: 0fceecd3d7bff048b97cb50bff4efa8b2bdd43cbc4e75ca0194e5c0bdf9c0183
4
- data.tar.gz: 30184b0a7831e0c1ffd7d5fd1b8fc21d31c674aa24bf382a69df936eded890d4
3
+ metadata.gz: e1236d1165f3b66a96e58dc3cd1a6f99ae1c15886b01f4e18804f956b04a9b4a
4
+ data.tar.gz: 1d2040be22e0ed1583983666af88983b4fd9d5a133f6d3ade05fe3c3af7b00a6
5
5
  SHA512:
6
- metadata.gz: ef26e597ef2c8d76fbef4c74c923767d3026ad3c6a46018df61613e53ca5fce3ab0b099f123c1c6e3fc72fb70f00b5e9eb53e124979e371ba7bea7dac68d59fe
7
- data.tar.gz: e17e42d84adc7823faf1e4073e0490bbd5a067818d742bcc6d87fb05b861c3950cf9bf08ca590f740242d285cc2a5e7fd05ccbca0378885bb844ed6c376cb361
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. `TracePoint` and `method_added` and `singleton_method_added` and `included` and `extended`.
186
+ Use so many ruby hooks. `method_added` and `singleton_method_added` and `included` and `extended`.
187
187
 
188
188
  ## Development
189
189
 
@@ -39,29 +39,20 @@ module Finalist
39
39
  :end
40
40
  end
41
41
 
42
- tp = TracePoint.new(event_type) do |ev|
43
- if ev.self == base
44
- base.ancestors.drop(1).each do |mod|
45
- Finalist.finalized_methods[mod]&.each do |fmeth_name|
46
- if meth = base.instance_method(fmeth_name)
47
- super_method = meth.super_method
48
- while super_method
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
@@ -1,3 +1,3 @@
1
1
  module Finalist
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-24 00:00:00.000000000 Z
11
+ date: 2018-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler