enhanced_errors 3.0.2 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -3
- data/benchmark/benchmark.rb +31 -29
- data/benchmark/memory_bench.rb +1 -1
- data/benchmark/result.txt +13 -0
- data/doc/Enhanced/Colors.html +2 -2
- data/doc/Enhanced/Context.html +283 -0
- data/doc/Enhanced/ExceptionBindingInfos.html +255 -0
- data/doc/Enhanced/ExceptionContext.html +397 -0
- data/doc/Enhanced.html +8 -4
- data/doc/EnhancedErrors.html +385 -269
- data/doc/EnhancedExceptionContext.html +15 -15
- data/doc/Exception.html +5 -5
- data/doc/ExceptionBindingInfos.html +2 -2
- data/doc/Minitest.html +3 -3
- data/doc/_index.html +12 -6
- data/doc/class_list.html +1 -1
- data/doc/file.README.html +9 -4
- data/doc/index.html +9 -4
- data/doc/method_list.html +34 -18
- data/doc/top-level-namespace.html +18 -8
- data/enhanced_errors.gemspec +1 -1
- data/lib/enhanced/context.rb +7 -5
- data/lib/enhanced/exception.rb +35 -36
- data/lib/enhanced/exception_context.rb +49 -0
- data/lib/enhanced/minitest_patch.rb +1 -1
- data/lib/enhanced_errors.rb +170 -122
- metadata +8 -9
- data/.yardoc/checksums +0 -6
- data/.yardoc/complete +0 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/lib/enhanced/enhanced_exception_context.rb +0 -47
data/doc/EnhancedErrors.html
CHANGED
@@ -121,7 +121,7 @@
|
|
121
121
|
<dt id="DEFAULT_MAX_CAPTURE_LENGTH-constant" class="">DEFAULT_MAX_CAPTURE_LENGTH =
|
122
122
|
|
123
123
|
</dt>
|
124
|
-
<dd><pre class="code"><span class='int'>
|
124
|
+
<dd><pre class="code"><span class='int'>2200</span></pre></dd>
|
125
125
|
|
126
126
|
<dt id="MAX_BINDING_INFOS-constant" class="">MAX_BINDING_INFOS =
|
127
127
|
|
@@ -154,13 +154,8 @@
|
|
154
154
|
|
155
155
|
</dt>
|
156
156
|
<dd><pre class="code"><span class='lbracket'>[</span>
|
157
|
-
<span class='symbol'>:@new_record</span><span class='comma'>,</span>
|
158
|
-
<span class='symbol'>:@attributes</span><span class='comma'>,</span>
|
159
157
|
<span class='symbol'>:@association_cache</span><span class='comma'>,</span>
|
160
|
-
<span class='symbol'>:@readonly</span><span class='comma'>,</span>
|
161
|
-
<span class='symbol'>:@previously_new_record</span><span class='comma'>,</span>
|
162
158
|
<span class='symbol'>:@_routes</span><span class='comma'>,</span>
|
163
|
-
<span class='symbol'>:@routes</span><span class='comma'>,</span>
|
164
159
|
<span class='symbol'>:@app</span><span class='comma'>,</span>
|
165
160
|
<span class='symbol'>:@arel_table</span><span class='comma'>,</span>
|
166
161
|
<span class='symbol'>:@assertion_instance</span><span class='comma'>,</span>
|
@@ -946,6 +941,30 @@
|
|
946
941
|
|
947
942
|
<span class="summary_desc"><div class='inline'></div></span>
|
948
943
|
|
944
|
+
</li>
|
945
|
+
|
946
|
+
|
947
|
+
<li class="public ">
|
948
|
+
<span class="summary_signature">
|
949
|
+
|
950
|
+
<a href="#safe_to_inspect%3F-class_method" title="safe_to_inspect? (class method)">.<strong>safe_to_inspect?</strong>(obj) ⇒ Boolean </a>
|
951
|
+
|
952
|
+
|
953
|
+
|
954
|
+
</span>
|
955
|
+
|
956
|
+
|
957
|
+
|
958
|
+
|
959
|
+
|
960
|
+
|
961
|
+
|
962
|
+
|
963
|
+
|
964
|
+
<span class="summary_desc"><div class='inline'>
|
965
|
+
<p>Here, we are detecting BasicObject, which is surprisingly annoying.</p>
|
966
|
+
</div></span>
|
967
|
+
|
949
968
|
</li>
|
950
969
|
|
951
970
|
|
@@ -1012,6 +1031,30 @@
|
|
1012
1031
|
|
1013
1032
|
<span class="summary_desc"><div class='inline'></div></span>
|
1014
1033
|
|
1034
|
+
</li>
|
1035
|
+
|
1036
|
+
|
1037
|
+
<li class="public ">
|
1038
|
+
<span class="summary_signature">
|
1039
|
+
|
1040
|
+
<a href="#start_rspec_binding_trap-class_method" title="start_rspec_binding_trap (class method)">.<strong>start_rspec_binding_trap</strong> ⇒ Object </a>
|
1041
|
+
|
1042
|
+
|
1043
|
+
|
1044
|
+
</span>
|
1045
|
+
|
1046
|
+
|
1047
|
+
|
1048
|
+
|
1049
|
+
|
1050
|
+
|
1051
|
+
|
1052
|
+
|
1053
|
+
|
1054
|
+
<span class="summary_desc"><div class='inline'>
|
1055
|
+
<p>Behavior: Grabs the next rspec spec binding that goes by, and stops the more-expensive b_return trace.</p>
|
1056
|
+
</div></span>
|
1057
|
+
|
1015
1058
|
</li>
|
1016
1059
|
|
1017
1060
|
|
@@ -1374,18 +1417,18 @@
|
|
1374
1417
|
<pre class="lines">
|
1375
1418
|
|
1376
1419
|
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1420
|
+
181
|
1421
|
+
182
|
1422
|
+
183
|
1423
|
+
184
|
1424
|
+
185</pre>
|
1382
1425
|
</td>
|
1383
1426
|
<td>
|
1384
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1427
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 181</span>
|
1385
1428
|
|
1386
1429
|
<span class='kw'>def</span> <span class='id identifier rubyid_add_to_skip_list'>add_to_skip_list</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_vars'>vars</span><span class='rparen'>)</span>
|
1387
1430
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
1388
|
-
<span class='ivar'>@skip_list</span><span class='period'>.</span><span class='id identifier
|
1431
|
+
<span class='ivar'>@skip_list</span><span class='period'>.</span><span class='id identifier rubyid_add'>add</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_vars'>vars</span><span class='rparen'>)</span>
|
1389
1432
|
<span class='kw'>end</span>
|
1390
1433
|
<span class='kw'>end</span></pre>
|
1391
1434
|
</td>
|
@@ -1408,29 +1451,23 @@
|
|
1408
1451
|
<pre class="lines">
|
1409
1452
|
|
1410
1453
|
|
1454
|
+
462
|
1411
1455
|
463
|
1412
1456
|
464
|
1413
1457
|
465
|
1414
1458
|
466
|
1415
1459
|
467
|
1416
1460
|
468
|
1417
|
-
469
|
1418
|
-
470
|
1419
|
-
471
|
1420
|
-
472
|
1421
|
-
473</pre>
|
1461
|
+
469</pre>
|
1422
1462
|
</td>
|
1423
1463
|
<td>
|
1424
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1464
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 462</span>
|
1425
1465
|
|
1426
1466
|
<span class='kw'>def</span> <span class='id identifier rubyid_apply_skip_list'>apply_skip_list</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
|
1427
|
-
<span class='id identifier
|
1428
|
-
|
1429
|
-
|
1430
|
-
<span class='id identifier
|
1431
|
-
<span class='kw'>if</span> <span class='ivar'>@debug</span>
|
1432
|
-
<span class='id identifier rubyid_variables'>variables</span><span class='lbracket'>[</span><span class='symbol'>:globals</span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1433
|
-
<span class='kw'>end</span>
|
1467
|
+
<span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:instances</span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='op'>||</span> <span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='lbracket'>[</span><span class='int'>0</span><span class='comma'>,</span> <span class='int'>2</span><span class='rbracket'>]</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>@_</span><span class='tstring_end'>'</span></span> <span class='op'>&&</span> <span class='op'>!</span><span class='ivar'>@debug</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1468
|
+
<span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:locals</span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1469
|
+
<span class='kw'>if</span> <span class='ivar'>@debug</span>
|
1470
|
+
<span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span><span class='lbracket'>[</span><span class='symbol'>:globals</span><span class='rbracket'>]</span><span class='op'>&.</span><span class='id identifier rubyid_reject!'>reject!</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid__'>_</span><span class='op'>|</span> <span class='id identifier rubyid_skip_list'>skip_list</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
1434
1471
|
<span class='kw'>end</span>
|
1435
1472
|
<span class='id identifier rubyid_binding_info'>binding_info</span>
|
1436
1473
|
<span class='kw'>end</span></pre>
|
@@ -1454,10 +1491,6 @@
|
|
1454
1491
|
<pre class="lines">
|
1455
1492
|
|
1456
1493
|
|
1457
|
-
482
|
1458
|
-
483
|
1459
|
-
484
|
1460
|
-
485
|
1461
1494
|
486
|
1462
1495
|
487
|
1463
1496
|
488
|
@@ -1497,10 +1530,14 @@
|
|
1497
1530
|
522
|
1498
1531
|
523
|
1499
1532
|
524
|
1500
|
-
525
|
1533
|
+
525
|
1534
|
+
526
|
1535
|
+
527
|
1536
|
+
528
|
1537
|
+
529</pre>
|
1501
1538
|
</td>
|
1502
1539
|
<td>
|
1503
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1540
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 486</span>
|
1504
1541
|
|
1505
1542
|
<span class='kw'>def</span> <span class='id identifier rubyid_binding_info_string'>binding_info_string</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
|
1506
1543
|
<span class='id identifier rubyid_exception'>exception</span> <span class='op'>=</span> <span class='id identifier rubyid_safe_to_s'>safe_to_s</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:exception</span><span class='rbracket'>]</span><span class='rparen'>)</span>
|
@@ -1566,16 +1603,16 @@
|
|
1566
1603
|
<pre class="lines">
|
1567
1604
|
|
1568
1605
|
|
1569
|
-
428
|
1570
|
-
429
|
1571
|
-
430
|
1572
|
-
431
|
1573
1606
|
432
|
1574
1607
|
433
|
1575
|
-
434
|
1608
|
+
434
|
1609
|
+
435
|
1610
|
+
436
|
1611
|
+
437
|
1612
|
+
438</pre>
|
1576
1613
|
</td>
|
1577
1614
|
<td>
|
1578
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1615
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 432</span>
|
1579
1616
|
|
1580
1617
|
<span class='kw'>def</span> <span class='id identifier rubyid_binding_infos_array_to_string'>binding_infos_array_to_string</span><span class='lparen'>(</span><span class='id identifier rubyid_captured_bindings'>captured_bindings</span><span class='comma'>,</span> <span class='id identifier rubyid_format'>format</span> <span class='op'>=</span> <span class='symbol'>:terminal</span><span class='rparen'>)</span>
|
1581
1618
|
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_captured_bindings'>captured_bindings</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_captured_bindings'>captured_bindings</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
@@ -1604,12 +1641,12 @@
|
|
1604
1641
|
<pre class="lines">
|
1605
1642
|
|
1606
1643
|
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1644
|
+
118
|
1645
|
+
119
|
1646
|
+
120</pre>
|
1610
1647
|
</td>
|
1611
1648
|
<td>
|
1612
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1649
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 118</span>
|
1613
1650
|
|
1614
1651
|
<span class='kw'>def</span> <span class='id identifier rubyid_capture_rescue'>capture_rescue</span>
|
1615
1652
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='ivar'>@capture_rescue</span> <span class='rbrace'>}</span>
|
@@ -1634,12 +1671,12 @@
|
|
1634
1671
|
<pre class="lines">
|
1635
1672
|
|
1636
1673
|
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1674
|
+
114
|
1675
|
+
115
|
1676
|
+
116</pre>
|
1640
1677
|
</td>
|
1641
1678
|
<td>
|
1642
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1679
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 114</span>
|
1643
1680
|
|
1644
1681
|
<span class='kw'>def</span> <span class='id identifier rubyid_capture_rescue='>capture_rescue=</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
1645
1682
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='ivar'>@capture_rescue</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span> <span class='rbrace'>}</span>
|
@@ -1664,17 +1701,17 @@
|
|
1664
1701
|
<pre class="lines">
|
1665
1702
|
|
1666
1703
|
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1704
|
+
254
|
1705
|
+
255
|
1706
|
+
256
|
1707
|
+
257
|
1708
|
+
258
|
1709
|
+
259
|
1710
|
+
260
|
1711
|
+
261</pre>
|
1675
1712
|
</td>
|
1676
1713
|
<td>
|
1677
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1714
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 254</span>
|
1678
1715
|
|
1679
1716
|
<span class='kw'>def</span> <span class='id identifier rubyid_class_to_string'>class_to_string</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
|
1680
1717
|
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
@@ -1704,8 +1741,6 @@
|
|
1704
1741
|
<pre class="lines">
|
1705
1742
|
|
1706
1743
|
|
1707
|
-
325
|
1708
|
-
326
|
1709
1744
|
327
|
1710
1745
|
328
|
1711
1746
|
329
|
@@ -1743,10 +1778,14 @@
|
|
1743
1778
|
361
|
1744
1779
|
362
|
1745
1780
|
363
|
1746
|
-
364
|
1781
|
+
364
|
1782
|
+
365
|
1783
|
+
366
|
1784
|
+
367
|
1785
|
+
368</pre>
|
1747
1786
|
</td>
|
1748
1787
|
<td>
|
1749
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1788
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 327</span>
|
1750
1789
|
|
1751
1790
|
<span class='kw'>def</span> <span class='id identifier rubyid_convert_binding_to_binding_info'>convert_binding_to_binding_info</span><span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span><span class='comma'>,</span> <span class='label'>capture_let_variables:</span> <span class='kw'>true</span><span class='rparen'>)</span>
|
1752
1791
|
<span class='id identifier rubyid_file'>file</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_eval'>eval</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>__FILE__</span><span class='tstring_end'>"</span></span><span class='rparen'>)</span> <span class='kw'>rescue</span> <span class='kw'>nil</span>
|
@@ -1755,6 +1794,8 @@
|
|
1755
1794
|
|
1756
1795
|
<span class='id identifier rubyid_locals'>locals</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_local_variables'>local_variables</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid_safe_local_variable_get'>safe_local_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_b'>b</span><span class='comma'>,</span> <span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span>
|
1757
1796
|
<span class='id identifier rubyid_receiver'>receiver</span> <span class='op'>=</span> <span class='id identifier rubyid_b'>b</span><span class='period'>.</span><span class='id identifier rubyid_receiver'>receiver</span>
|
1797
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_safe_to_inspect?'>safe_to_inspect?</span><span class='lparen'>(</span><span class='id identifier rubyid_receiver'>receiver</span><span class='rparen'>)</span>
|
1798
|
+
|
1758
1799
|
<span class='id identifier rubyid_instance_vars'>instance_vars</span> <span class='op'>=</span> <span class='id identifier rubyid_receiver'>receiver</span><span class='period'>.</span><span class='id identifier rubyid_instance_variables'>instance_variables</span>
|
1759
1800
|
<span class='id identifier rubyid_instances'>instances</span> <span class='op'>=</span> <span class='id identifier rubyid_instance_vars'>instance_vars</span><span class='period'>.</span><span class='id identifier rubyid_map'>map</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_var'>var</span><span class='op'>|</span> <span class='lbracket'>[</span><span class='id identifier rubyid_var'>var</span><span class='comma'>,</span> <span class='id identifier rubyid_safe_instance_variable_get'>safe_instance_variable_get</span><span class='lparen'>(</span><span class='id identifier rubyid_receiver'>receiver</span><span class='comma'>,</span> <span class='id identifier rubyid_var'>var</span><span class='rparen'>)</span><span class='rbracket'>]</span> <span class='rbrace'>}</span><span class='period'>.</span><span class='id identifier rubyid_to_h'>to_h</span>
|
1760
1801
|
|
@@ -1783,7 +1824,7 @@
|
|
1783
1824
|
<span class='label'>globals:</span> <span class='lbrace'>{</span><span class='rbrace'>}</span>
|
1784
1825
|
<span class='rbrace'>}</span><span class='comma'>,</span>
|
1785
1826
|
<span class='label'>exception:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>NoException</span><span class='tstring_end'>'</span></span><span class='comma'>,</span>
|
1786
|
-
<span class='label'>capture_event:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>
|
1827
|
+
<span class='label'>capture_event:</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test_context</span><span class='tstring_end'>'</span></span>
|
1787
1828
|
<span class='rbrace'>}</span>
|
1788
1829
|
|
1789
1830
|
<span class='id identifier rubyid_default_on_capture'>default_on_capture</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
|
@@ -1808,17 +1849,17 @@
|
|
1808
1849
|
<pre class="lines">
|
1809
1850
|
|
1810
1851
|
|
1852
|
+
130
|
1853
|
+
131
|
1854
|
+
132
|
1855
|
+
133
|
1811
1856
|
134
|
1812
1857
|
135
|
1813
1858
|
136
|
1814
|
-
137
|
1815
|
-
138
|
1816
|
-
139
|
1817
|
-
140
|
1818
|
-
141</pre>
|
1859
|
+
137</pre>
|
1819
1860
|
</td>
|
1820
1861
|
<td>
|
1821
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1862
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 130</span>
|
1822
1863
|
|
1823
1864
|
<span class='kw'>def</span> <span class='id identifier rubyid_disable_capturing!'>disable_capturing!</span>
|
1824
1865
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -1848,6 +1889,16 @@
|
|
1848
1889
|
<pre class="lines">
|
1849
1890
|
|
1850
1891
|
|
1892
|
+
187
|
1893
|
+
188
|
1894
|
+
189
|
1895
|
+
190
|
1896
|
+
191
|
1897
|
+
192
|
1898
|
+
193
|
1899
|
+
194
|
1900
|
+
195
|
1901
|
+
196
|
1851
1902
|
197
|
1852
1903
|
198
|
1853
1904
|
199
|
@@ -1877,21 +1928,14 @@
|
|
1877
1928
|
223
|
1878
1929
|
224
|
1879
1930
|
225
|
1880
|
-
226
|
1881
|
-
227
|
1882
|
-
228
|
1883
|
-
229
|
1884
|
-
230
|
1885
|
-
231
|
1886
|
-
232
|
1887
|
-
233
|
1888
|
-
234</pre>
|
1931
|
+
226</pre>
|
1889
1932
|
</td>
|
1890
1933
|
<td>
|
1891
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
1934
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 187</span>
|
1892
1935
|
|
1893
1936
|
<span class='kw'>def</span> <span class='id identifier rubyid_enhance_exceptions!'>enhance_exceptions!</span><span class='lparen'>(</span><span class='label'>enabled:</span> <span class='kw'>true</span><span class='comma'>,</span> <span class='label'>debug:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='label'>capture_events:</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='label'>override_messages:</span> <span class='kw'>false</span><span class='comma'>,</span> <span class='op'>**</span><span class='id identifier rubyid_options'>options</span><span class='comma'>,</span> <span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
1894
1937
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
1938
|
+
<span class='id identifier rubyid_ensure_extensions_are_required'>ensure_extensions_are_required</span>
|
1895
1939
|
<span class='ivar'>@exception_trace</span><span class='op'>&.</span><span class='id identifier rubyid_disable'>disable</span>
|
1896
1940
|
<span class='ivar'>@exception_trace</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
1897
1941
|
|
@@ -1922,10 +1966,11 @@
|
|
1922
1966
|
|
1923
1967
|
<span class='id identifier rubyid_events'>events</span> <span class='op'>=</span> <span class='ivar'>@capture_events</span> <span class='op'>?</span> <span class='ivar'>@capture_events</span><span class='period'>.</span><span class='id identifier rubyid_to_a'>to_a</span> <span class='op'>:</span> <span class='id identifier rubyid_default_capture_events'>default_capture_events</span>
|
1924
1968
|
<span class='ivar'>@exception_trace</span> <span class='op'>=</span> <span class='const'>TracePoint</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='op'>*</span><span class='id identifier rubyid_events'>events</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tp'>tp</span><span class='op'>|</span>
|
1969
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_exception_is_handleable?'>exception_is_handleable?</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_raised_exception'>raised_exception</span><span class='rparen'>)</span>
|
1925
1970
|
<span class='id identifier rubyid_handle_tracepoint_event'>handle_tracepoint_event</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='rparen'>)</span>
|
1926
1971
|
<span class='kw'>end</span>
|
1927
1972
|
|
1928
|
-
<span class='ivar'>@exception_trace</span><span class='
|
1973
|
+
<span class='ivar'>@exception_trace</span><span class='op'>&.</span><span class='id identifier rubyid_enable'>enable</span> <span class='kw'>if</span> <span class='ivar'>@enabled</span>
|
1929
1974
|
<span class='kw'>end</span>
|
1930
1975
|
<span class='kw'>end</span></pre>
|
1931
1976
|
</td>
|
@@ -1948,10 +1993,6 @@
|
|
1948
1993
|
<pre class="lines">
|
1949
1994
|
|
1950
1995
|
|
1951
|
-
408
|
1952
|
-
409
|
1953
|
-
410
|
1954
|
-
411
|
1955
1996
|
412
|
1956
1997
|
413
|
1957
1998
|
414
|
@@ -1966,10 +2007,14 @@
|
|
1966
2007
|
423
|
1967
2008
|
424
|
1968
2009
|
425
|
1969
|
-
426
|
2010
|
+
426
|
2011
|
+
427
|
2012
|
+
428
|
2013
|
+
429
|
2014
|
+
430</pre>
|
1970
2015
|
</td>
|
1971
2016
|
<td>
|
1972
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2017
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 412</span>
|
1973
2018
|
|
1974
2019
|
<span class='kw'>def</span> <span class='id identifier rubyid_format'>format</span><span class='lparen'>(</span><span class='id identifier rubyid_captured_binding_infos'>captured_binding_infos</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='rbracket'>]</span><span class='comma'>,</span> <span class='id identifier rubyid_output_format'>output_format</span> <span class='op'>=</span> <span class='id identifier rubyid_get_default_format_for_environment'>get_default_format_for_environment</span><span class='rparen'>)</span>
|
1975
2020
|
<span class='kw'>return</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_end'>'</span></span> <span class='kw'>if</span> <span class='id identifier rubyid_captured_binding_infos'>captured_binding_infos</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_captured_binding_infos'>captured_binding_infos</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span>
|
@@ -2010,10 +2055,6 @@
|
|
2010
2055
|
<pre class="lines">
|
2011
2056
|
|
2012
2057
|
|
2013
|
-
436
|
2014
|
-
437
|
2015
|
-
438
|
2016
|
-
439
|
2017
2058
|
440
|
2018
2059
|
441
|
2019
2060
|
442
|
@@ -2030,7 +2071,7 @@
|
|
2030
2071
|
453</pre>
|
2031
2072
|
</td>
|
2032
2073
|
<td>
|
2033
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2074
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 440</span>
|
2034
2075
|
|
2035
2076
|
<span class='kw'>def</span> <span class='id identifier rubyid_get_default_format_for_environment'>get_default_format_for_environment</span>
|
2036
2077
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2038,11 +2079,7 @@
|
|
2038
2079
|
<span class='id identifier rubyid_env'>env</span> <span class='op'>=</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RAILS_ENV</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='const'>ENV</span><span class='lbracket'>[</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RACK_ENV</span><span class='tstring_end'>'</span></span><span class='rbracket'>]</span> <span class='op'>||</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>development</span><span class='tstring_end'>'</span></span>
|
2039
2080
|
<span class='ivar'>@output_format</span> <span class='op'>=</span> <span class='kw'>case</span> <span class='id identifier rubyid_env'>env</span>
|
2040
2081
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>development</span><span class='tstring_end'>'</span></span><span class='comma'>,</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test</span><span class='tstring_end'>'</span></span>
|
2041
|
-
<span class='
|
2042
|
-
<span class='symbol'>:plaintext</span>
|
2043
|
-
<span class='kw'>else</span>
|
2044
|
-
<span class='symbol'>:terminal</span>
|
2045
|
-
<span class='kw'>end</span>
|
2082
|
+
<span class='id identifier rubyid_running_in_ci?'>running_in_ci?</span> <span class='op'>?</span> <span class='symbol'>:plaintext</span> <span class='op'>:</span> <span class='symbol'>:terminal</span>
|
2046
2083
|
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>production</span><span class='tstring_end'>'</span></span>
|
2047
2084
|
<span class='symbol'>:json</span>
|
2048
2085
|
<span class='kw'>else</span>
|
@@ -2092,12 +2129,12 @@
|
|
2092
2129
|
<pre class="lines">
|
2093
2130
|
|
2094
2131
|
|
2095
|
-
|
2096
|
-
|
2097
|
-
|
2132
|
+
228
|
2133
|
+
229
|
2134
|
+
230</pre>
|
2098
2135
|
</td>
|
2099
2136
|
<td>
|
2100
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2137
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 228</span>
|
2101
2138
|
|
2102
2139
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_a_minitest?'>is_a_minitest?</span><span class='lparen'>(</span><span class='id identifier rubyid_klass'>klass</span><span class='rparen'>)</span>
|
2103
2140
|
<span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_ancestors'>ancestors</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='const'><span class='object_link'><a href="Minitest.html" title="Minitest (module)">Minitest</a></span></span><span class='op'>::</span><span class='const'>Test</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_klass'>klass</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span> <span class='op'>!=</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>Minitest::Test</span><span class='tstring_end'>'</span></span>
|
@@ -2144,12 +2181,12 @@
|
|
2144
2181
|
<pre class="lines">
|
2145
2182
|
|
2146
2183
|
|
2147
|
-
|
2148
|
-
|
2149
|
-
|
2184
|
+
263
|
2185
|
+
264
|
2186
|
+
265</pre>
|
2150
2187
|
</td>
|
2151
2188
|
<td>
|
2152
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2189
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 263</span>
|
2153
2190
|
|
2154
2191
|
<span class='kw'>def</span> <span class='id identifier rubyid_is_rspec_example?'>is_rspec_example?</span><span class='lparen'>(</span><span class='id identifier rubyid_tracepoint'>tracepoint</span><span class='rparen'>)</span>
|
2155
2192
|
<span class='id identifier rubyid_tracepoint'>tracepoint</span><span class='period'>.</span><span class='id identifier rubyid_method_id'>method_id</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>&&</span> <span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_tracepoint'>tracepoint</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>rspec</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_tracepoint'>tracepoint</span><span class='period'>.</span><span class='id identifier rubyid_path'>path</span><span class='period'>.</span><span class='id identifier rubyid_end_with?'>end_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>_spec.rb</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span>
|
@@ -2174,12 +2211,12 @@
|
|
2174
2211
|
<pre class="lines">
|
2175
2212
|
|
2176
2213
|
|
2177
|
-
|
2178
|
-
|
2179
|
-
|
2214
|
+
122
|
2215
|
+
123
|
2216
|
+
124</pre>
|
2180
2217
|
</td>
|
2181
2218
|
<td>
|
2182
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2219
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 122</span>
|
2183
2220
|
|
2184
2221
|
<span class='kw'>def</span> <span class='id identifier rubyid_max_capture_length'>max_capture_length</span>
|
2185
2222
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='ivar'>@max_capture_length</span> <span class='op'>||</span> <span class='const'><span class='object_link'><a href="#DEFAULT_MAX_CAPTURE_LENGTH-constant" title="EnhancedErrors::DEFAULT_MAX_CAPTURE_LENGTH (constant)">DEFAULT_MAX_CAPTURE_LENGTH</a></span></span> <span class='rbrace'>}</span>
|
@@ -2204,12 +2241,12 @@
|
|
2204
2241
|
<pre class="lines">
|
2205
2242
|
|
2206
2243
|
|
2207
|
-
|
2208
|
-
|
2209
|
-
|
2244
|
+
126
|
2245
|
+
127
|
2246
|
+
128</pre>
|
2210
2247
|
</td>
|
2211
2248
|
<td>
|
2212
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2249
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 126</span>
|
2213
2250
|
|
2214
2251
|
<span class='kw'>def</span> <span class='id identifier rubyid_max_capture_length='>max_capture_length=</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
2215
2252
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='lbrace'>{</span> <span class='ivar'>@max_capture_length</span> <span class='op'>=</span> <span class='id identifier rubyid_value'>value</span> <span class='rbrace'>}</span>
|
@@ -2264,18 +2301,18 @@
|
|
2264
2301
|
<pre class="lines">
|
2265
2302
|
|
2266
2303
|
|
2267
|
-
376
|
2268
|
-
377
|
2269
|
-
378
|
2270
|
-
379
|
2271
2304
|
380
|
2272
2305
|
381
|
2273
2306
|
382
|
2274
2307
|
383
|
2275
|
-
384
|
2308
|
+
384
|
2309
|
+
385
|
2310
|
+
386
|
2311
|
+
387
|
2312
|
+
388</pre>
|
2276
2313
|
</td>
|
2277
2314
|
<td>
|
2278
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2315
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 380</span>
|
2279
2316
|
|
2280
2317
|
<span class='kw'>def</span> <span class='id identifier rubyid_on_capture'>on_capture</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2281
2318
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2306,14 +2343,14 @@
|
|
2306
2343
|
<pre class="lines">
|
2307
2344
|
|
2308
2345
|
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2346
|
+
390
|
2347
|
+
391
|
2348
|
+
392
|
2349
|
+
393
|
2350
|
+
394</pre>
|
2314
2351
|
</td>
|
2315
2352
|
<td>
|
2316
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2353
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 390</span>
|
2317
2354
|
|
2318
2355
|
<span class='kw'>def</span> <span class='id identifier rubyid_on_capture='>on_capture=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
2319
2356
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2340,18 +2377,18 @@
|
|
2340
2377
|
<pre class="lines">
|
2341
2378
|
|
2342
2379
|
|
2343
|
-
392
|
2344
|
-
393
|
2345
|
-
394
|
2346
|
-
395
|
2347
2380
|
396
|
2348
2381
|
397
|
2349
2382
|
398
|
2350
2383
|
399
|
2351
|
-
400
|
2384
|
+
400
|
2385
|
+
401
|
2386
|
+
402
|
2387
|
+
403
|
2388
|
+
404</pre>
|
2352
2389
|
</td>
|
2353
2390
|
<td>
|
2354
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2391
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 396</span>
|
2355
2392
|
|
2356
2393
|
<span class='kw'>def</span> <span class='id identifier rubyid_on_format'>on_format</span><span class='lparen'>(</span><span class='op'>&</span><span class='id identifier rubyid_block'>block</span><span class='rparen'>)</span>
|
2357
2394
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2382,14 +2419,14 @@
|
|
2382
2419
|
<pre class="lines">
|
2383
2420
|
|
2384
2421
|
|
2385
|
-
|
2386
|
-
|
2387
|
-
|
2388
|
-
|
2389
|
-
|
2422
|
+
406
|
2423
|
+
407
|
2424
|
+
408
|
2425
|
+
409
|
2426
|
+
410</pre>
|
2390
2427
|
</td>
|
2391
2428
|
<td>
|
2392
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2429
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 406</span>
|
2393
2430
|
|
2394
2431
|
<span class='kw'>def</span> <span class='id identifier rubyid_on_format='>on_format=</span><span class='lparen'>(</span><span class='id identifier rubyid_value'>value</span><span class='rparen'>)</span>
|
2395
2432
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2416,31 +2453,19 @@
|
|
2416
2453
|
<pre class="lines">
|
2417
2454
|
|
2418
2455
|
|
2456
|
+
172
|
2457
|
+
173
|
2458
|
+
174
|
2459
|
+
175
|
2419
2460
|
176
|
2420
2461
|
177
|
2421
2462
|
178
|
2422
|
-
179
|
2423
|
-
180
|
2424
|
-
181
|
2425
|
-
182
|
2426
|
-
183
|
2427
|
-
184
|
2428
|
-
185
|
2429
|
-
186
|
2430
|
-
187
|
2431
|
-
188
|
2432
|
-
189</pre>
|
2463
|
+
179</pre>
|
2433
2464
|
</td>
|
2434
2465
|
<td>
|
2435
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2466
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 172</span>
|
2436
2467
|
|
2437
2468
|
<span class='kw'>def</span> <span class='id identifier rubyid_override_exception_message'>override_exception_message</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='rparen'>)</span>
|
2438
|
-
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='id identifier rubyid_exception'>exception</span> <span class='op'>&&</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:message</span><span class='rparen'>)</span>
|
2439
|
-
<span class='id identifier rubyid_test_binding'>test_binding</span> <span class='op'>=</span> <span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span> <span class='op'>||</span> <span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='period'>.</span><span class='id identifier rubyid_empty?'>empty?</span><span class='rparen'>)</span>
|
2440
|
-
<span class='id identifier rubyid_exception_binding'>exception_binding</span> <span class='op'>=</span> <span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_binding_infos'>binding_infos</span><span class='period'>.</span><span class='id identifier rubyid_length'>length</span> <span class='op'>></span> <span class='int'>0</span><span class='rparen'>)</span>
|
2441
|
-
<span class='id identifier rubyid_has_message'>has_message</span> <span class='op'>=</span> <span class='op'>!</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_respond_to?'>respond_to?</span><span class='lparen'>(</span><span class='symbol'>:unaltered_message</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2442
|
-
<span class='kw'>return</span> <span class='kw'>nil</span> <span class='kw'>unless</span> <span class='lparen'>(</span><span class='id identifier rubyid_test_binding'>test_binding</span> <span class='op'>||</span> <span class='id identifier rubyid_exception_binding'>exception_binding</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_has_message'>has_message</span>
|
2443
|
-
|
2444
2469
|
<span class='id identifier rubyid_variable_str'>variable_str</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="" title="EnhancedErrors (class)">EnhancedErrors</a></span></span><span class='period'>.</span><span class='id identifier rubyid_format'><span class='object_link'><a href="#format-class_method" title="EnhancedErrors.format (method)">format</a></span></span><span class='lparen'>(</span><span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='rparen'>)</span>
|
2445
2470
|
<span class='id identifier rubyid_message_str'>message_str</span> <span class='op'>=</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_message'>message</span>
|
2446
2471
|
<span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_define_singleton_method'>define_singleton_method</span><span class='lparen'>(</span><span class='symbol'>:unaltered_message</span><span class='rparen'>)</span> <span class='lbrace'>{</span> <span class='id identifier rubyid_message_str'>message_str</span> <span class='rbrace'>}</span>
|
@@ -2468,6 +2493,13 @@
|
|
2468
2493
|
<pre class="lines">
|
2469
2494
|
|
2470
2495
|
|
2496
|
+
155
|
2497
|
+
156
|
2498
|
+
157
|
2499
|
+
158
|
2500
|
+
159
|
2501
|
+
160
|
2502
|
+
161
|
2471
2503
|
162
|
2472
2504
|
163
|
2473
2505
|
164
|
@@ -2476,26 +2508,25 @@
|
|
2476
2508
|
167
|
2477
2509
|
168
|
2478
2510
|
169
|
2479
|
-
170
|
2480
|
-
171
|
2481
|
-
172
|
2482
|
-
173
|
2483
|
-
174</pre>
|
2511
|
+
170</pre>
|
2484
2512
|
</td>
|
2485
2513
|
<td>
|
2486
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2514
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 155</span>
|
2487
2515
|
|
2488
2516
|
<span class='kw'>def</span> <span class='id identifier rubyid_override_rspec_message'>override_rspec_message</span><span class='lparen'>(</span><span class='id identifier rubyid_example'>example</span><span class='comma'>,</span> <span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='rparen'>)</span>
|
2489
2517
|
<span class='id identifier rubyid_exception_obj'>exception_obj</span> <span class='op'>=</span> <span class='id identifier rubyid_example'>example</span><span class='period'>.</span><span class='id identifier rubyid_exception'>exception</span>
|
2490
|
-
<span class='kw'>
|
2491
|
-
|
2492
|
-
|
2493
|
-
<span class='kw'>
|
2518
|
+
<span class='kw'>return</span> <span class='kw'>if</span> <span class='id identifier rubyid_exception_obj'>exception_obj</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2519
|
+
|
2520
|
+
<span class='id identifier rubyid_from_bindings'>from_bindings</span> <span class='op'>=</span> <span class='lbracket'>[</span><span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_flatten'>flatten</span><span class='period'>.</span><span class='id identifier rubyid_compact'>compact</span>
|
2521
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_exception_obj'>exception_obj</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span>
|
2522
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RSpec::Core::MultipleExceptionError</span><span class='tstring_end'>'</span></span>
|
2494
2523
|
<span class='id identifier rubyid_exception_obj'>exception_obj</span><span class='period'>.</span><span class='id identifier rubyid_all_exceptions'>all_exceptions</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_exception'>exception</span><span class='op'>|</span>
|
2495
|
-
<span class='id identifier rubyid_override_exception_message'>override_exception_message</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier
|
2524
|
+
<span class='id identifier rubyid_override_exception_message'>override_exception_message</span><span class='lparen'>(</span><span class='id identifier rubyid_exception'>exception</span><span class='comma'>,</span> <span class='id identifier rubyid_from_bindings'>from_bindings</span> <span class='op'>+</span> <span class='id identifier rubyid_exception'>exception</span><span class='period'>.</span><span class='id identifier rubyid_binding_infos'>binding_infos</span><span class='rparen'>)</span>
|
2496
2525
|
<span class='kw'>end</span>
|
2497
|
-
<span class='kw'>
|
2526
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RSpec::Expectations::ExpectationNotMetError</span><span class='tstring_end'>'</span></span>
|
2498
2527
|
<span class='id identifier rubyid_override_exception_message'>override_exception_message</span><span class='lparen'>(</span><span class='id identifier rubyid_exception_obj'>exception_obj</span><span class='comma'>,</span> <span class='id identifier rubyid_binding_or_bindings'>binding_or_bindings</span><span class='rparen'>)</span>
|
2528
|
+
<span class='kw'>else</span>
|
2529
|
+
<span class='id identifier rubyid_override_exception_message'>override_exception_message</span><span class='lparen'>(</span><span class='id identifier rubyid_exception_obj'>exception_obj</span><span class='comma'>,</span> <span class='id identifier rubyid_from_bindings'>from_bindings</span> <span class='op'>+</span> <span class='id identifier rubyid_exception_obj'>exception_obj</span><span class='period'>.</span><span class='id identifier rubyid_binding_infos'>binding_infos</span><span class='rparen'>)</span>
|
2499
2530
|
<span class='kw'>end</span>
|
2500
2531
|
<span class='kw'>end</span></pre>
|
2501
2532
|
</td>
|
@@ -2518,20 +2549,20 @@
|
|
2518
2549
|
<pre class="lines">
|
2519
2550
|
|
2520
2551
|
|
2552
|
+
139
|
2553
|
+
140
|
2554
|
+
141
|
2555
|
+
142
|
2556
|
+
143
|
2521
2557
|
144
|
2522
2558
|
145
|
2523
2559
|
146
|
2524
2560
|
147
|
2525
2561
|
148
|
2526
|
-
149
|
2527
|
-
150
|
2528
|
-
151
|
2529
|
-
152
|
2530
|
-
153
|
2531
|
-
154</pre>
|
2562
|
+
149</pre>
|
2532
2563
|
</td>
|
2533
2564
|
<td>
|
2534
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2565
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 139</span>
|
2535
2566
|
|
2536
2567
|
<span class='kw'>def</span> <span class='id identifier rubyid_reset!'>reset!</span>
|
2537
2568
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2591,8 +2622,7 @@
|
|
2591
2622
|
457
|
2592
2623
|
458
|
2593
2624
|
459
|
2594
|
-
460
|
2595
|
-
461</pre>
|
2625
|
+
460</pre>
|
2596
2626
|
</td>
|
2597
2627
|
<td>
|
2598
2628
|
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 455</span>
|
@@ -2600,13 +2630,74 @@
|
|
2600
2630
|
<span class='kw'>def</span> <span class='id identifier rubyid_running_in_ci?'>running_in_ci?</span>
|
2601
2631
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
2602
2632
|
<span class='kw'>return</span> <span class='ivar'>@running_in_ci</span> <span class='kw'>if</span> <span class='kw'>defined?</span><span class='lparen'>(</span><span class='ivar'>@running_in_ci</span><span class='rparen'>)</span>
|
2603
|
-
|
2604
2633
|
<span class='ivar'>@running_in_ci</span> <span class='op'>=</span> <span class='const'><span class='object_link'><a href="#CI_ENV_VARS-constant" title="EnhancedErrors::CI_ENV_VARS (constant)">CI_ENV_VARS</a></span></span><span class='period'>.</span><span class='id identifier rubyid_any?'>any?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid__'>_</span><span class='comma'>,</span> <span class='id identifier rubyid_value'>value</span><span class='op'>|</span> <span class='id identifier rubyid_value'>value</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_downcase'>downcase</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>true</span><span class='tstring_end'>'</span></span> <span class='rbrace'>}</span>
|
2605
2634
|
<span class='kw'>end</span>
|
2606
2635
|
<span class='kw'>end</span></pre>
|
2607
2636
|
</td>
|
2608
2637
|
</tr>
|
2609
2638
|
</table>
|
2639
|
+
</div>
|
2640
|
+
|
2641
|
+
<div class="method_details ">
|
2642
|
+
<h3 class="signature " id="safe_to_inspect?-class_method">
|
2643
|
+
|
2644
|
+
.<strong>safe_to_inspect?</strong>(obj) ⇒ <tt>Boolean</tt>
|
2645
|
+
|
2646
|
+
|
2647
|
+
|
2648
|
+
|
2649
|
+
|
2650
|
+
</h3><div class="docstring">
|
2651
|
+
<div class="discussion">
|
2652
|
+
|
2653
|
+
<p>Here, we are detecting BasicObject, which is surprisingly annoying. We also, importantly, need to detect descendants, as they will also present with a lack of :respond_to? and any other useful method for us.</p>
|
2654
|
+
|
2655
|
+
|
2656
|
+
</div>
|
2657
|
+
</div>
|
2658
|
+
<div class="tags">
|
2659
|
+
|
2660
|
+
<p class="tag_title">Returns:</p>
|
2661
|
+
<ul class="return">
|
2662
|
+
|
2663
|
+
<li>
|
2664
|
+
|
2665
|
+
|
2666
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
2667
|
+
|
2668
|
+
|
2669
|
+
|
2670
|
+
</li>
|
2671
|
+
|
2672
|
+
</ul>
|
2673
|
+
|
2674
|
+
</div><table class="source_code">
|
2675
|
+
<tr>
|
2676
|
+
<td>
|
2677
|
+
<pre class="lines">
|
2678
|
+
|
2679
|
+
|
2680
|
+
478
|
2681
|
+
479
|
2682
|
+
480
|
2683
|
+
481
|
2684
|
+
482
|
2685
|
+
483
|
2686
|
+
484</pre>
|
2687
|
+
</td>
|
2688
|
+
<td>
|
2689
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 478</span>
|
2690
|
+
|
2691
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_safe_to_inspect?'>safe_to_inspect?</span><span class='lparen'>(</span><span class='id identifier rubyid_obj'>obj</span><span class='rparen'>)</span>
|
2692
|
+
<span class='kw'>begin</span>
|
2693
|
+
<span class='id identifier rubyid_obj'>obj</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span>
|
2694
|
+
<span class='kw'>rescue</span> <span class='const'>NoMethodError</span>
|
2695
|
+
<span class='kw'>return</span> <span class='kw'>false</span>
|
2696
|
+
<span class='kw'>end</span>
|
2697
|
+
<span class='kw'>end</span></pre>
|
2698
|
+
</td>
|
2699
|
+
</tr>
|
2700
|
+
</table>
|
2610
2701
|
</div>
|
2611
2702
|
|
2612
2703
|
<div class="method_details ">
|
@@ -2624,19 +2715,15 @@
|
|
2624
2715
|
<pre class="lines">
|
2625
2716
|
|
2626
2717
|
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2630
|
-
159
|
2631
|
-
160</pre>
|
2718
|
+
151
|
2719
|
+
152
|
2720
|
+
153</pre>
|
2632
2721
|
</td>
|
2633
2722
|
<td>
|
2634
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2723
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 151</span>
|
2635
2724
|
|
2636
2725
|
<span class='kw'>def</span> <span class='id identifier rubyid_skip_list'>skip_list</span>
|
2637
|
-
<span class='
|
2638
|
-
<span class='ivar'>@skip_list</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="#DEFAULT_SKIP_LIST-constant" title="EnhancedErrors::DEFAULT_SKIP_LIST (constant)">DEFAULT_SKIP_LIST</a></span></span>
|
2639
|
-
<span class='kw'>end</span>
|
2726
|
+
<span class='ivar'>@skip_list</span> <span class='op'>||=</span> <span class='const'><span class='object_link'><a href="#DEFAULT_SKIP_LIST-constant" title="EnhancedErrors::DEFAULT_SKIP_LIST (constant)">DEFAULT_SKIP_LIST</a></span></span><span class='period'>.</span><span class='id identifier rubyid_to_set'>to_set</span>
|
2640
2727
|
<span class='kw'>end</span></pre>
|
2641
2728
|
</td>
|
2642
2729
|
</tr>
|
@@ -2658,24 +2745,26 @@
|
|
2658
2745
|
<pre class="lines">
|
2659
2746
|
|
2660
2747
|
|
2748
|
+
232
|
2749
|
+
233
|
2750
|
+
234
|
2751
|
+
235
|
2752
|
+
236
|
2753
|
+
237
|
2754
|
+
238
|
2755
|
+
239
|
2661
2756
|
240
|
2662
2757
|
241
|
2663
2758
|
242
|
2664
2759
|
243
|
2665
|
-
244
|
2666
|
-
245
|
2667
|
-
246
|
2668
|
-
247
|
2669
|
-
248
|
2670
|
-
249
|
2671
|
-
250
|
2672
|
-
251</pre>
|
2760
|
+
244</pre>
|
2673
2761
|
</td>
|
2674
2762
|
<td>
|
2675
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2763
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 232</span>
|
2676
2764
|
|
2677
2765
|
<span class='kw'>def</span> <span class='id identifier rubyid_start_minitest_binding_capture'>start_minitest_binding_capture</span>
|
2678
|
-
<span class='
|
2766
|
+
<span class='id identifier rubyid_ensure_extensions_are_required'>ensure_extensions_are_required</span>
|
2767
|
+
<span class='const'><span class='object_link'><a href="Enhanced.html" title="Enhanced (module)">Enhanced</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Enhanced/ExceptionContext.html" title="Enhanced::ExceptionContext (module)">ExceptionContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_clear_all'><span class='object_link'><a href="Enhanced/ExceptionContext.html#clear_all-instance_method" title="Enhanced::ExceptionContext#clear_all (method)">clear_all</a></span></span>
|
2679
2768
|
<span class='ivar'>@enabled</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='ivar'>@enabled</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2680
2769
|
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@enabled</span>
|
2681
2770
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2683,7 +2772,7 @@
|
|
2683
2772
|
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_method_id'>method_id</span><span class='period'>.</span><span class='id identifier rubyid_to_s'>to_s</span><span class='period'>.</span><span class='id identifier rubyid_start_with?'>start_with?</span><span class='lparen'>(</span><span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>test_</span><span class='tstring_end'>'</span></span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_is_a_minitest?'>is_a_minitest?</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_defined_class'>defined_class</span><span class='rparen'>)</span>
|
2684
2773
|
<span class='ivar'>@minitest_test_binding</span> <span class='op'>=</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_binding'>binding</span>
|
2685
2774
|
<span class='kw'>end</span>
|
2686
|
-
<span class='ivar'>@minitest_trace</span><span class='
|
2775
|
+
<span class='ivar'>@minitest_trace</span><span class='op'>&.</span><span class='id identifier rubyid_enable'>enable</span>
|
2687
2776
|
<span class='kw'>end</span>
|
2688
2777
|
<span class='kw'>end</span></pre>
|
2689
2778
|
</td>
|
@@ -2706,6 +2795,14 @@
|
|
2706
2795
|
<pre class="lines">
|
2707
2796
|
|
2708
2797
|
|
2798
|
+
267
|
2799
|
+
268
|
2800
|
+
269
|
2801
|
+
270
|
2802
|
+
271
|
2803
|
+
272
|
2804
|
+
273
|
2805
|
+
274
|
2709
2806
|
275
|
2710
2807
|
276
|
2711
2808
|
277
|
@@ -2720,17 +2817,65 @@
|
|
2720
2817
|
286
|
2721
2818
|
287
|
2722
2819
|
288
|
2723
|
-
289
|
2724
|
-
|
2725
|
-
|
2726
|
-
|
2727
|
-
|
2728
|
-
|
2729
|
-
|
2730
|
-
|
2731
|
-
|
2732
|
-
|
2733
|
-
|
2820
|
+
289</pre>
|
2821
|
+
</td>
|
2822
|
+
<td>
|
2823
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 267</span>
|
2824
|
+
|
2825
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_start_rspec_binding_capture'>start_rspec_binding_capture</span>
|
2826
|
+
<span class='id identifier rubyid_ensure_extensions_are_required'>ensure_extensions_are_required</span>
|
2827
|
+
<span class='const'><span class='object_link'><a href="Enhanced.html" title="Enhanced (module)">Enhanced</a></span></span><span class='op'>::</span><span class='const'><span class='object_link'><a href="Enhanced/ExceptionContext.html" title="Enhanced::ExceptionContext (module)">ExceptionContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_clear_all'><span class='object_link'><a href="Enhanced/ExceptionContext.html#clear_all-instance_method" title="Enhanced::ExceptionContext#clear_all (method)">clear_all</a></span></span>
|
2828
|
+
<span class='ivar'>@enabled</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='ivar'>@enabled</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2829
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@enabled</span>
|
2830
|
+
|
2831
|
+
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
2832
|
+
<span class='ivar'>@rspec_example_binding</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2833
|
+
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='kw'>false</span>
|
2834
|
+
<span class='ivar'>@rspec_tracepoint</span><span class='op'>&.</span><span class='id identifier rubyid_disable'>disable</span>
|
2835
|
+
<span class='ivar'>@rspec_tracepoint</span> <span class='op'>=</span> <span class='const'>TracePoint</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:raise</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tp'>tp</span><span class='op'>|</span>
|
2836
|
+
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='id identifier rubyid_exception_is_handleable?'>exception_is_handleable?</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_raised_exception'>raised_exception</span><span class='rparen'>)</span>
|
2837
|
+
<span class='id identifier rubyid_class_name'>class_name</span> <span class='op'>=</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_raised_exception'>raised_exception</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
|
2838
|
+
<span class='kw'>case</span> <span class='id identifier rubyid_class_name'>class_name</span>
|
2839
|
+
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RSpec::Expectations::ExpectationNotMetError</span><span class='tstring_end'>'</span></span>
|
2840
|
+
<span class='id identifier rubyid_start_rspec_binding_trap'>start_rspec_binding_trap</span>
|
2841
|
+
<span class='kw'>else</span>
|
2842
|
+
<span class='id identifier rubyid_handle_tracepoint_event'>handle_tracepoint_event</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='rparen'>)</span>
|
2843
|
+
<span class='kw'>end</span>
|
2844
|
+
<span class='kw'>end</span>
|
2845
|
+
<span class='kw'>end</span>
|
2846
|
+
<span class='ivar'>@rspec_tracepoint</span><span class='op'>&.</span><span class='id identifier rubyid_enable'>enable</span>
|
2847
|
+
<span class='kw'>end</span></pre>
|
2848
|
+
</td>
|
2849
|
+
</tr>
|
2850
|
+
</table>
|
2851
|
+
</div>
|
2852
|
+
|
2853
|
+
<div class="method_details ">
|
2854
|
+
<h3 class="signature " id="start_rspec_binding_trap-class_method">
|
2855
|
+
|
2856
|
+
.<strong>start_rspec_binding_trap</strong> ⇒ <tt>Object</tt>
|
2857
|
+
|
2858
|
+
|
2859
|
+
|
2860
|
+
|
2861
|
+
|
2862
|
+
</h3><div class="docstring">
|
2863
|
+
<div class="discussion">
|
2864
|
+
|
2865
|
+
<p>Behavior: Grabs the next rspec spec binding that goes by, and stops the more-expensive b_return trace. This part of RSpec has been stable, since 2015, so although this is kluge-y, it is stable. The optimization does a 2-3x on spec speed vs. opening up the Tracepoint. With it, things are pretty close in speed to plain rspec. Should the behavior change this can be updated by using a trace to print out items and their local variables then, find the exception or call that goes by right before the spec blocks with the variables, and use that to narrow-down the costly part of the probe to just this point in time. The good news is that this part is test-time only, and this optimization and kluge only applies to RSpec.</p>
|
2866
|
+
|
2867
|
+
|
2868
|
+
</div>
|
2869
|
+
</div>
|
2870
|
+
<div class="tags">
|
2871
|
+
|
2872
|
+
|
2873
|
+
</div><table class="source_code">
|
2874
|
+
<tr>
|
2875
|
+
<td>
|
2876
|
+
<pre class="lines">
|
2877
|
+
|
2878
|
+
|
2734
2879
|
300
|
2735
2880
|
301
|
2736
2881
|
302
|
@@ -2743,48 +2888,27 @@
|
|
2743
2888
|
309
|
2744
2889
|
310
|
2745
2890
|
311
|
2746
|
-
312
|
2891
|
+
312
|
2892
|
+
313
|
2893
|
+
314</pre>
|
2747
2894
|
</td>
|
2748
2895
|
<td>
|
2749
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2750
|
-
|
2751
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_start_rspec_binding_capture'>start_rspec_binding_capture</span>
|
2752
|
-
<span class='const'><span class='object_link'><a href="EnhancedExceptionContext.html" title="EnhancedExceptionContext (module)">EnhancedExceptionContext</a></span></span><span class='period'>.</span><span class='id identifier rubyid_clear_all'><span class='object_link'><a href="EnhancedExceptionContext.html#clear_all-instance_method" title="EnhancedExceptionContext#clear_all (method)">clear_all</a></span></span>
|
2753
|
-
<span class='ivar'>@enabled</span> <span class='op'>=</span> <span class='kw'>true</span> <span class='kw'>if</span> <span class='ivar'>@enabled</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
|
2754
|
-
<span class='kw'>return</span> <span class='kw'>unless</span> <span class='ivar'>@enabled</span>
|
2755
|
-
|
2756
|
-
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
2757
|
-
<span class='ivar'>@rspec_example_binding</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2758
|
-
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='kw'>false</span>
|
2759
|
-
<span class='ivar'>@rspec_tracepoint</span><span class='op'>&.</span><span class='id identifier rubyid_disable'>disable</span>
|
2896
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 300</span>
|
2760
2897
|
|
2761
|
-
|
2762
|
-
|
2763
|
-
|
2764
|
-
</span>
|
2765
|
-
</span>
|
2766
|
-
|
2767
|
-
<span class='kw'>if</span> <span class='const'><span class='object_link'><a href="#RSPEC_HANDLER_NAMES-constant" title="EnhancedErrors::RSPEC_HANDLER_NAMES (constant)">RSPEC_HANDLER_NAMES</a></span></span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_class_to_string'>class_to_string</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_defined_class'>defined_class</span><span class='rparen'>)</span><span class='rparen'>)</span>
|
2768
|
-
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='symbol'>:next</span>
|
2769
|
-
<span class='kw'>next</span>
|
2770
|
-
<span class='kw'>end</span>
|
2771
|
-
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='ivar'>@capture_next_binding</span>
|
2772
|
-
<span class='kw'>if</span> <span class='ivar'>@capture_next_binding</span> <span class='op'>==</span> <span class='symbol'>:next</span> <span class='op'>||</span> <span class='ivar'>@capture_next_binding</span> <span class='op'>==</span> <span class='symbol'>:next_matching</span> <span class='op'>&&</span> <span class='id identifier rubyid_is_rspec_example?'>is_rspec_example?</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='rparen'>)</span>
|
2773
|
-
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='kw'>false</span>
|
2774
|
-
<span class='ivar'>@rspec_example_binding</span> <span class='op'>=</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_binding'>binding</span>
|
2775
|
-
<span class='kw'>end</span>
|
2776
|
-
<span class='kw'>elsif</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_event'>event</span> <span class='op'>==</span> <span class='symbol'>:raise</span>
|
2777
|
-
<span class='id identifier rubyid_class_name'>class_name</span> <span class='op'>=</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_raised_exception'>raised_exception</span><span class='period'>.</span><span class='id identifier rubyid_class'>class</span><span class='period'>.</span><span class='id identifier rubyid_name'>name</span>
|
2778
|
-
<span class='kw'>case</span> <span class='id identifier rubyid_class_name'>class_name</span>
|
2779
|
-
<span class='kw'>when</span> <span class='tstring'><span class='tstring_beg'>'</span><span class='tstring_content'>RSpec::Expectations::ExpectationNotMetError</span><span class='tstring_end'>'</span></span>
|
2780
|
-
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='symbol'>:next_matching</span>
|
2781
|
-
<span class='kw'>else</span>
|
2782
|
-
<span class='id identifier rubyid_handle_tracepoint_event'>handle_tracepoint_event</span><span class='lparen'>(</span><span class='id identifier rubyid_tp'>tp</span><span class='rparen'>)</span>
|
2783
|
-
<span class='kw'>end</span>
|
2784
|
-
<span class='kw'>end</span>
|
2898
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_start_rspec_binding_trap'>start_rspec_binding_trap</span>
|
2899
|
+
<span class='ivar'>@rspec_binding_trap</span> <span class='op'>=</span> <span class='const'>TracePoint</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='symbol'>:b_return</span><span class='rparen'>)</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_tp'>tp</span><span class='op'>|</span>
|
2900
|
+
<span class='comment'># kluge-y hack and will be a pain to maintain
|
2901
|
+
</span> <span class='kw'>if</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_callee_id'>callee_id</span> <span class='op'>==</span> <span class='symbol'>:handle_matcher</span>
|
2902
|
+
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='symbol'>:next</span>
|
2903
|
+
<span class='kw'>next</span>
|
2785
2904
|
<span class='kw'>end</span>
|
2786
|
-
<span class='
|
2905
|
+
<span class='kw'>next</span> <span class='kw'>unless</span> <span class='ivar'>@capture_next_binding</span>
|
2906
|
+
<span class='ivar'>@capture_next_binding</span> <span class='op'>=</span> <span class='kw'>false</span>
|
2907
|
+
<span class='ivar'>@rspec_example_binding</span> <span class='op'>=</span> <span class='id identifier rubyid_tp'>tp</span><span class='period'>.</span><span class='id identifier rubyid_binding'>binding</span>
|
2908
|
+
<span class='ivar'>@rspec_binding_trap</span><span class='op'>&.</span><span class='id identifier rubyid_disable'>disable</span>
|
2909
|
+
<span class='ivar'>@rspec_binding_trap</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2787
2910
|
<span class='kw'>end</span>
|
2911
|
+
<span class='ivar'>@rspec_binding_trap</span><span class='op'>&.</span><span class='id identifier rubyid_enable'>enable</span>
|
2788
2912
|
<span class='kw'>end</span></pre>
|
2789
2913
|
</td>
|
2790
2914
|
</tr>
|
@@ -2806,25 +2930,23 @@
|
|
2806
2930
|
<pre class="lines">
|
2807
2931
|
|
2808
2932
|
|
2809
|
-
|
2810
|
-
|
2811
|
-
|
2812
|
-
|
2813
|
-
|
2814
|
-
|
2815
|
-
|
2816
|
-
260</pre>
|
2933
|
+
246
|
2934
|
+
247
|
2935
|
+
248
|
2936
|
+
249
|
2937
|
+
250
|
2938
|
+
251
|
2939
|
+
252</pre>
|
2817
2940
|
</td>
|
2818
2941
|
<td>
|
2819
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2942
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 246</span>
|
2820
2943
|
|
2821
2944
|
<span class='kw'>def</span> <span class='id identifier rubyid_stop_minitest_binding_capture'>stop_minitest_binding_capture</span>
|
2822
2945
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
2823
2946
|
<span class='ivar'>@minitest_trace</span><span class='op'>&.</span><span class='id identifier rubyid_disable'>disable</span>
|
2824
2947
|
<span class='ivar'>@minitest_trace</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
2825
2948
|
<span class='id identifier rubyid_convert_binding_to_binding_info'>convert_binding_to_binding_info</span><span class='lparen'>(</span><span class='ivar'>@minitest_test_binding</span><span class='rparen'>)</span> <span class='kw'>if</span> <span class='ivar'>@minitest_test_binding</span>
|
2826
|
-
|
2827
|
-
</span> <span class='kw'>end</span>
|
2949
|
+
<span class='kw'>end</span>
|
2828
2950
|
<span class='kw'>end</span></pre>
|
2829
2951
|
</td>
|
2830
2952
|
</tr>
|
@@ -2846,8 +2968,6 @@
|
|
2846
2968
|
<pre class="lines">
|
2847
2969
|
|
2848
2970
|
|
2849
|
-
314
|
2850
|
-
315
|
2851
2971
|
316
|
2852
2972
|
317
|
2853
2973
|
318
|
@@ -2855,10 +2975,12 @@
|
|
2855
2975
|
320
|
2856
2976
|
321
|
2857
2977
|
322
|
2858
|
-
323
|
2978
|
+
323
|
2979
|
+
324
|
2980
|
+
325</pre>
|
2859
2981
|
</td>
|
2860
2982
|
<td>
|
2861
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
2983
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 316</span>
|
2862
2984
|
|
2863
2985
|
<span class='kw'>def</span> <span class='id identifier rubyid_stop_rspec_binding_capture'>stop_rspec_binding_capture</span>
|
2864
2986
|
<span class='id identifier rubyid_mutex'>mutex</span><span class='period'>.</span><span class='id identifier rubyid_synchronize'>synchronize</span> <span class='kw'>do</span>
|
@@ -2890,21 +3012,15 @@
|
|
2890
3012
|
<pre class="lines">
|
2891
3013
|
|
2892
3014
|
|
2893
|
-
|
2894
|
-
|
2895
|
-
|
2896
|
-
478
|
2897
|
-
479
|
2898
|
-
480</pre>
|
3015
|
+
471
|
3016
|
+
472
|
3017
|
+
473</pre>
|
2899
3018
|
</td>
|
2900
3019
|
<td>
|
2901
|
-
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line
|
3020
|
+
<pre class="code"><span class="info file"># File 'lib/enhanced_errors.rb', line 471</span>
|
2902
3021
|
|
2903
3022
|
<span class='kw'>def</span> <span class='id identifier rubyid_validate_binding_format'>validate_binding_format</span><span class='lparen'>(</span><span class='id identifier rubyid_binding_info'>binding_info</span><span class='rparen'>)</span>
|
2904
|
-
<span class='
|
2905
|
-
<span class='kw'>return</span> <span class='kw'>nil</span>
|
2906
|
-
<span class='kw'>end</span>
|
2907
|
-
<span class='id identifier rubyid_binding_info'>binding_info</span>
|
3023
|
+
<span class='id identifier rubyid_binding_info'>binding_info</span><span class='period'>.</span><span class='id identifier rubyid_keys'>keys</span><span class='period'>.</span><span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='symbol'>:capture_event</span><span class='rparen'>)</span> <span class='op'>&&</span> <span class='id identifier rubyid_binding_info'>binding_info</span><span class='lbracket'>[</span><span class='symbol'>:variables</span><span class='rbracket'>]</span><span class='period'>.</span><span class='id identifier rubyid_is_a?'>is_a?</span><span class='lparen'>(</span><span class='const'>Hash</span><span class='rparen'>)</span>
|
2908
3024
|
<span class='kw'>end</span></pre>
|
2909
3025
|
</td>
|
2910
3026
|
</tr>
|
@@ -2916,9 +3032,9 @@
|
|
2916
3032
|
</div>
|
2917
3033
|
|
2918
3034
|
<div id="footer">
|
2919
|
-
Generated on Tue Dec
|
3035
|
+
Generated on Tue Dec 24 15:27:20 2024 by
|
2920
3036
|
<a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
2921
|
-
0.9.37 (ruby-3.3
|
3037
|
+
0.9.37 (ruby-3.1.3).
|
2922
3038
|
</div>
|
2923
3039
|
|
2924
3040
|
</div>
|