diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2021-06-30 12:31:55 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2021-06-30 12:49:27 +0900 |
commit | ca4e5b1eb33f3bae9ced2e7643ae7db3e11fa65d (patch) | |
tree | 84d6f1063974ba212da96066ae1eeb68f293b0cf /lib/error_highlight/core_ext.rb | |
parent | f428ced69c70473b8405aae9c98828aa6f69b254 (diff) |
[ruby/error_highlight] Reconsider the API of ErrorHighlight.spot
https://github.com/ruby/error_highlight/commit/acb2046a82
Diffstat (limited to 'lib/error_highlight/core_ext.rb')
-rw-r--r-- | lib/error_highlight/core_ext.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/error_highlight/core_ext.rb b/lib/error_highlight/core_ext.rb index 3cfc72951d..d8d2175f8a 100644 --- a/lib/error_highlight/core_ext.rb +++ b/lib/error_highlight/core_ext.rb @@ -21,16 +21,13 @@ module ErrorHighlight case self when NoMethodError, NameError - point = :name + opts[:point_type] = :name opts[:name] = name when TypeError, ArgumentError - point = :args + opts[:point_type] = :args end - spot = ErrorHighlight.spot(node, point, **opts) do |lineno, last_lineno| - last_lineno ||= lineno - node.script_lines[lineno - 1 .. last_lineno - 1].join("") - end + spot = ErrorHighlight.spot(node, **opts) rescue Errno::ENOENT end |