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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec5682e86b9081039947fc2718c8cdc42d2407af8cb0da30244a41b994d917f5
4
- data.tar.gz: f8471eed0b3144951e4bb834e63013339e1af67842278e1bac7368c82070e76d
3
+ metadata.gz: 243882f1477717a2109d6206f3ed9b2d05ddc15f3a40e30262064ec5e5b2c180
4
+ data.tar.gz: 41a8407b1a93ff4ba101d96fface1dd34a75cf014133bd577e3b5c3eacd1400b
5
5
  SHA512:
6
- metadata.gz: 9be1797f3865b5ed1f0cbf6b98c3a8ceca6342b689212a801e55e2ad1e3499618a1439746744260d719bda4e9895c0ff080b2a2e43a971414f06f18a60f9cb33
7
- data.tar.gz: b3852ade5823458ff7a5da0e6e89416c3c9edd326fa3466781ad52cdf876aaa8ee032949b98a52b6646f37b8b8d7256a57ff41d1a5c01c041be4b53b88738232
6
+ metadata.gz: bec1240f2d68575246b3ae7c8dce73e6ef665e791186e769739955322e6af74ef5c448a5c0c2f7c1b2a9780c13e1d09e4c74956d2f956968b2028727a30e9e9b
7
+ data.tar.gz: c352cdcabb1d2bbc1240e65ef3fd3439918bfb0b046fd7a6085dd276772e204f3ae2db125564eb8d453a086d09c80a2e36868f191f45995fc2990f8a1e4dd013
checksums.yaml.gz.sig CHANGED
Binary file
@@ -1,3 +1,3 @@
1
1
  class Computable
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
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.select.with_index{|loc, i| loc.path == fpath && loc.lineno >= lineno && !bt[i].include?("#") }.min{|a,b| a.lineno <=> b.lineno }
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
 
@@ -2,13 +2,19 @@ require_relative 'helper'
2
2
 
3
3
  class TestBacktrace < Minitest::Test
4
4
  class MyBuilder < Computable
5
- calc_value :a do
6
- b
5
+ calc_value :b do
6
+ c
7
7
  end
8
8
 
9
- calc_value :b do
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:.* #b$/, bt)
27
- assert_match(/test_backtrace.rb:6:.* #a$/, bt)
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
- 9o�W�J��%���e��2*x�l� 8Q�f§�J��K����r�'[�@�]pI�BYj��'EJ*��2'���� ��Jt�V�P�+�+�|Le�N�v�6ʻ�9$�#�K��V�摂�-M�gRU1|֩$�ʵz~G�A�F~ׅ��`���o��x�=n}�匹�����E�K�§?��1�R�$񻏊M4�y��;�N }��x-k�;�od���k�huVKTB5�z�$�ޅ�}y Da �N
2
- ֣=��Caj
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.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
- MIIDLjCCAhagAwIBAgIBCjANBgkqhkiG9w0BAQsFADA9MQ4wDAYDVQQDDAVrYW5p
13
+ MIIDLjCCAhagAwIBAgIBCzANBgkqhkiG9w0BAQsFADA9MQ4wDAYDVQQDDAVr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
+ x17ugO3IOsjEJwW7KP4wDQYJKoZIhvcNAQELBQADggEBACAxNXwfMGG7paZjnG/c
25
+ smdi/ocW2GmCNtILaSzDZqlD5LoA68MiO7u5vwWyBaDJ6giUB330VJoGRbWMxvxN
26
+ JU6Bnwa4yYp9YtF91wYIi7FXwIrCPKd9bk3bf4M5wECdsv+zvVceq2zRXqD7fci8
27
+ 1LRG8ort/f4TgaT7B4aNwOaabA2UT6u0FGeglqxLkhir86MY3QQyBfJZUoTKWGkz
28
+ S9a7GXsYpe+8HMOaE4+SZp8SORKPgATND5m/4VdzuO59VXjE5UP7QpXigbxAt7H7
29
+ ciK5Du2ZDhowmWzZwNzR7VvVmfAK6RQJlRB03VkkQRWGld5yApOrYDne6WbD8kE0
30
+ uM8=
31
31
  -----END CERTIFICATE-----
32
- date: 2022-06-01 00:00:00.000000000 Z
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.3.7
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