class ActionView::Template::Handlers::ERB
def translate_location(spot, _backtrace_location, source)
Translate an error location returned by ErrorHighlight to the correct
def translate_location(spot, _backtrace_location, source) compiled = spot[:script_lines] highlight = compiled[spot[:first_lineno] - 1]&.byteslice((spot[:first_column] - 1)...spot[:last_column]) return nil if highlight.blank? source_lines = source.lines lineno_delta = find_lineno_offset(compiled, source_lines, highlight, spot[:first_lineno]) tokens = ::ERB::Util.tokenize(source_lines[spot[:first_lineno] - lineno_delta - 1]) column_delta = find_offset(spot[:snippet], tokens, spot[:first_column]) spot[:first_lineno] -= lineno_delta spot[:last_lineno] -= lineno_delta spot[:first_column] -= column_delta spot[:last_column] -= column_delta spot[:script_lines] = source_lines spot rescue NotImplementedError, LocationParsingError nil end