модуль ErrorHighlight::CoreExt
Константы
- SKIP_TO_S_FOR_SUPER_LOOKUP
-
Это метка, позволяющая `DidYouMean::Correctable#original_message` пропустить следующее определение метода `to_s`. См. github.com/ruby/did_you_mean/pull/152
Открытые методы экземпляра
# File lib/error_highlight/core_ext.rb, line 11
def to_s
msg = super.dup
locs = backtrace_locations
return msg unless locs
loc = locs.first
begin
node = RubyVM::AbstractSyntaxTree.of(loc, keep_script_lines: true)
opts = {}
case self
when NoMethodError, NameError
opts[:point_type] = :name
opts[:name] = name
when TypeError, ArgumentError
opts[:point_type] = :args
end
spot = ErrorHighlight.spot(node, **opts)
rescue SyntaxError
rescue SystemCallError # file not found or something
rescue ArgumentError # eval'ed code
end
if spot
points = ErrorHighlight.formatter.message_for(spot)
msg << points if !msg.include?(points)
end
msg
end Вызывает метод суперкласса
Ruby Core © 1993–2022 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.