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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9ae1f66c6b1151cf65329869a64d4ea9ce7732344a6318aa99dc8a16aabeeff
4
- data.tar.gz: d2e52f94f74c6569cea530e8a843d99030c0a2860f38b8591952faedba759419
3
+ metadata.gz: eb083cc3162d22724aa838cfc6c8a6d3473436c9fa276d731c07a840bdab1466
4
+ data.tar.gz: 3fb0a3ac24c77556f3343a9da1f43de5fdbe4a6bdf70d96a468cbcae129f3a1a
5
5
  SHA512:
6
- metadata.gz: b6610f3e482792ae7f2eb8a2e8ada6c13f588b8d9fdbf2bac0948d99efb5046d92b9b5c83294661ecc91ffb1239b446b759d206db60da7dedaab5af48c7e3d4c
7
- data.tar.gz: 481f0da516eff4f75662bb709f56aeb11b380336f3fbd82465af16c24e48bbaa20d4590e5bdad5373c283f7d8eaba90c458bd807a6f1c1b809aef4710cb5a302
6
+ metadata.gz: 2d40e91d23f06e0f62db5c9945dc27c96590c0a36448e987e7d2c23b8b5947a978ba2f7918bc5d934342075d3926a525e64df159120c0c0026f19b8bc4203f4d
7
+ data.tar.gz: e7cb628e3cf5c60147a97ed96e02898ff9f444230aeed640c61c4998722e1cab6ea97149931340298ee525c72d5c2e663cc3f835fa116a9dbf22167ecad36e69
@@ -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
- # Just for compatibility
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
- # The extension for TypeError/ArgumentError is temporarily disabled due to many test failures
42
-
43
- #TypeError.prepend(CoreExt)
44
- #ArgumentError.prepend(CoreExt)
40
+ TypeError.prepend(CoreExt)
41
+ ArgumentError.prepend(CoreExt)
45
42
  end
@@ -1,3 +1,3 @@
1
1
  module ErrorHighlight
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  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.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-10 00:00:00.000000000 Z
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