computable 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/computable/version.rb +1 -1
- data/lib/computable.rb +7 -3
- data/test/test_backtrace.rb +37 -6
- data.tar.gz.sig +4 -2
- metadata +12 -12
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 243882f1477717a2109d6206f3ed9b2d05ddc15f3a40e30262064ec5e5b2c180
|
4
|
+
data.tar.gz: 41a8407b1a93ff4ba101d96fface1dd34a75cf014133bd577e3b5c3eacd1400b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bec1240f2d68575246b3ae7c8dce73e6ef665e791186e769739955322e6af74ef5c448a5c0c2f7c1b2a9780c13e1d09e4c74956d2f956968b2028727a30e9e9b
|
7
|
+
data.tar.gz: c352cdcabb1d2bbc1240e65ef3fd3439918bfb0b046fd7a6085dd276772e204f3ae2db125564eb8d453a086d09c80a2e36868f191f45995fc2990f8a1e4dd013
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/computable/version.rb
CHANGED
data/lib/computable.rb
CHANGED
@@ -90,7 +90,7 @@ class Computable
|
|
90
90
|
|
91
91
|
puts "recalc #{inspect}" if @comp.computable_debug
|
92
92
|
expired_from.each do |name2, v2|
|
93
|
-
v2.recalc_value
|
93
|
+
v2.recalc_value # Adjust improve_backtrace when moving this line within method recalc_value
|
94
94
|
end
|
95
95
|
|
96
96
|
unless expired_from.empty?
|
@@ -275,11 +275,15 @@ class Computable
|
|
275
275
|
end
|
276
276
|
|
277
277
|
private def improve_backtrace(err, block, text)
|
278
|
+
recalc_location_fpath, recalc_location_lineno = Variable.instance_method(:recalc_value).source_location
|
278
279
|
fpath, lineno = block.source_location
|
279
280
|
bt = err.backtrace
|
280
|
-
myloc = err.backtrace_locations.
|
281
|
+
myloc = err.backtrace_locations.find.with_index do |loc, i|
|
282
|
+
(loc.path == recalc_location_fpath && loc.lineno == recalc_location_lineno + 5 && !bt[i].include?("#")) ||
|
283
|
+
(loc.path == fpath && loc.lineno >= lineno && !bt[i].include?("#") && !bt[i].include?("#"))
|
284
|
+
end
|
281
285
|
idx = err.backtrace_locations.index(myloc)
|
282
|
-
bt[idx] += " ##{text}"
|
286
|
+
bt[idx] += " ##{text}" if idx
|
283
287
|
raise err
|
284
288
|
end
|
285
289
|
|
data/test/test_backtrace.rb
CHANGED
@@ -2,13 +2,19 @@ require_relative 'helper'
|
|
2
2
|
|
3
3
|
class TestBacktrace < Minitest::Test
|
4
4
|
class MyBuilder < Computable
|
5
|
-
calc_value :
|
6
|
-
|
5
|
+
calc_value :b do
|
6
|
+
c
|
7
7
|
end
|
8
8
|
|
9
|
-
calc_value :
|
10
|
-
raise "my error"
|
9
|
+
calc_value :c do
|
10
|
+
raise "my error" if enable
|
11
|
+
:x
|
11
12
|
end
|
13
|
+
|
14
|
+
calc_value :a do
|
15
|
+
b
|
16
|
+
end
|
17
|
+
input_value :enable
|
12
18
|
end
|
13
19
|
|
14
20
|
def setup
|
@@ -20,11 +26,36 @@ class TestBacktrace < Minitest::Test
|
|
20
26
|
end
|
21
27
|
|
22
28
|
def test_backtrace_decoration
|
29
|
+
@b.enable = true
|
30
|
+
err = assert_raises(StandardError){ @b.b }
|
31
|
+
bt = err.backtrace.join("\n")
|
32
|
+
assert_match(/my error/, err.to_s)
|
33
|
+
assert_match(/test_backtrace.rb:10:.* #c$/, bt)
|
34
|
+
assert_match(/test_backtrace.rb:6:.* #b$/, bt)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_recalc_backtrace_decoration
|
38
|
+
@b.enable = false
|
39
|
+
@b.b
|
40
|
+
@b.enable = true
|
41
|
+
|
42
|
+
err = assert_raises(StandardError){ @b.b }
|
43
|
+
bt = err.backtrace.join("\n")
|
44
|
+
assert_match(/my error/, err.to_s)
|
45
|
+
assert_match(/test_backtrace.rb:10:.* #c$/, bt)
|
46
|
+
assert_match(/block in recalc_value' #b$/, bt) unless @b.computable_max_threads
|
47
|
+
end
|
48
|
+
|
49
|
+
def test_recalc_longer_backtrace_decoration
|
50
|
+
@b.enable = false
|
51
|
+
@b.a
|
52
|
+
@b.enable = true
|
53
|
+
|
23
54
|
err = assert_raises(StandardError){ @b.a }
|
24
55
|
bt = err.backtrace.join("\n")
|
25
56
|
assert_match(/my error/, err.to_s)
|
26
|
-
assert_match(/test_backtrace.rb:10:.* #
|
27
|
-
assert_match(/
|
57
|
+
assert_match(/test_backtrace.rb:10:.* #c$/, bt)
|
58
|
+
assert_match(/block in recalc_value' #b.*block in recalc_value' #a$/m, bt) unless @b.computable_max_threads
|
28
59
|
end
|
29
60
|
end
|
30
61
|
|
data.tar.gz.sig
CHANGED
@@ -1,2 +1,4 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
�
|
2
|
+
��m��>�r"�=l�H��п��C>�%�V�n"����V�@$��'v�7���?��M�;�ҕ�U^X��b��_��>�*j�����)6�v��d�o
|
3
|
+
���kk������p��Yn��"�
|
4
|
+
q��a꿙�%B뻪�5��C�['���`e�/�ZB���z�
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: computable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lars Kanis
|
@@ -10,9 +10,9 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
13
|
+
MIIDLjCCAhagAwIBAgIBCzANBgkqhkiG9w0BAQsFADA9MQ4wDAYDVQQDDAVrYW5p
|
14
14
|
czEXMBUGCgmSJomT8ixkARkWB2NvbWNhcmQxEjAQ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
uM8=
|
31
31
|
-----END CERTIFICATE-----
|
32
|
-
date:
|
32
|
+
date: 2023-12-06 00:00:00.000000000 Z
|
33
33
|
dependencies:
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
35
|
name: bundler
|
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
127
|
- !ruby/object:Gem::Version
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
130
|
+
rubygems_version: 3.4.15
|
131
131
|
signing_key:
|
132
132
|
specification_version: 4
|
133
133
|
summary: Define computation tasks with automatic caching and dependency tracking.
|
metadata.gz.sig
CHANGED
Binary file
|