error_highlight 0.4.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/error_highlight/base.rb +9 -2
- data/lib/error_highlight/core_ext.rb +6 -4
- data/lib/error_highlight/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97374a7c69ab159c324e0592fae950fa9c065e9f3cd51130dbc2d39b65caa9c4
|
4
|
+
data.tar.gz: 470ef6d7ce73943e6e0260a581211987286fd366cde3663ad06a25dccb5f7234
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fceb2e95ac91526ebbb3b51e19c3a03cb888e77642045b4ab9b050abc0ab09f5e783a93edf7b22587e811d6b85cd1a798551ea2cebcaf1c82364318cee5c89b
|
7
|
+
data.tar.gz: 5972069a5065563327401a9fcff877ecaaeda664c15d3bf4cc6285f97366d46ede0742c6ebc81e2a86738bc39f0193a32164c59eb10675c43e540ed8bb414d2b
|
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"
|
@@ -38,8 +38,10 @@ module ErrorHighlight
|
|
38
38
|
|
39
39
|
NameError.prepend(CoreExt)
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
41
|
+
if Exception.method_defined?(:detailed_message)
|
42
|
+
# ErrorHighlight is enabled for TypeError and ArgumentError only when Exception#detailed_message is available.
|
43
|
+
# This is because changing ArgumentError#message is highly incompatible.
|
44
|
+
TypeError.prepend(CoreExt)
|
45
|
+
ArgumentError.prepend(CoreExt)
|
46
|
+
end
|
45
47
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke Endoh
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-14 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
|
@@ -35,7 +35,7 @@ homepage: https://github.com/ruby/error_highlight
|
|
35
35
|
licenses:
|
36
36
|
- MIT
|
37
37
|
metadata: {}
|
38
|
-
post_install_message:
|
38
|
+
post_install_message:
|
39
39
|
rdoc_options: []
|
40
40
|
require_paths:
|
41
41
|
- lib
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
53
|
rubygems_version: 3.3.7
|
54
|
-
signing_key:
|
54
|
+
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: Shows a one-line code snippet with an underline in the error backtrace
|
57
57
|
test_files: []
|