error_highlight 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/error_highlight/base.rb +9 -2
- data/lib/error_highlight/core_ext.rb +2 -5
- data/lib/error_highlight/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb083cc3162d22724aa838cfc6c8a6d3473436c9fa276d731c07a840bdab1466
|
4
|
+
data.tar.gz: 3fb0a3ac24c77556f3343a9da1f43de5fdbe4a6bdf70d96a468cbcae129f3a1a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d40e91d23f06e0f62db5c9945dc27c96590c0a36448e987e7d2c23b8b5947a978ba2f7918bc5d934342075d3926a525e64df159120c0c0026f19b8bc4203f4d
|
7
|
+
data.tar.gz: e7cb628e3cf5c60147a97ed96e02898ff9f444230aeed640c61c4998722e1cab6ea97149931340298ee525c72d5c2e663cc3f835fa116a9dbf22167ecad36e69
|
data/lib/error_highlight/base.rb
CHANGED
@@ -22,6 +22,14 @@ module ErrorHighlight
|
|
22
22
|
# snippet: String,
|
23
23
|
# script_lines: [String],
|
24
24
|
# } | nil
|
25
|
+
#
|
26
|
+
# Limitations:
|
27
|
+
#
|
28
|
+
# Currently, ErrorHighlight.spot only supports a single-line code fragment.
|
29
|
+
# Therefore, if the return value is not nil, first_lineno and last_lineno will have
|
30
|
+
# the same value. If the relevant code fragment spans multiple lines
|
31
|
+
# (e.g., Array#[] of +ary[(newline)expr(newline)]+), the method will return nil.
|
32
|
+
# This restriction may be removed in the future.
|
25
33
|
def self.spot(obj, **opts)
|
26
34
|
case obj
|
27
35
|
when Exception
|
@@ -51,8 +59,7 @@ module ErrorHighlight
|
|
51
59
|
Spotter.new(node, **opts).spot
|
52
60
|
|
53
61
|
when RubyVM::AbstractSyntaxTree::Node
|
54
|
-
|
55
|
-
Spotter.new(node, **opts).spot
|
62
|
+
Spotter.new(obj, **opts).spot
|
56
63
|
|
57
64
|
else
|
58
65
|
raise TypeError, "Exception is expected"
|
@@ -37,9 +37,6 @@ module ErrorHighlight
|
|
37
37
|
end
|
38
38
|
|
39
39
|
NameError.prepend(CoreExt)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
#TypeError.prepend(CoreExt)
|
44
|
-
#ArgumentError.prepend(CoreExt)
|
40
|
+
TypeError.prepend(CoreExt)
|
41
|
+
ArgumentError.prepend(CoreExt)
|
45
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: error_highlight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Endoh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08
|
11
|
+
date: 2022-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The gem enhances Exception#message by adding a short explanation where
|
14
14
|
the exception is raised
|