SILENT KILLERPanel

Current Path: > > opt > > alt > ruby32 > share > ruby > error_highlight


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt//alt/ruby32/share/ruby/error_highlight

NameTypeSizeLast ModifiedActions
base.rb File 14217 bytes April 24 2025 07:53:44.
core_ext.rb File 1416 bytes April 24 2025 07:53:44.
formatter.rb File 638 bytes April 24 2025 07:53:44.
version.rb File 46 bytes April 24 2025 07:53:44.

Reading File: //opt//alt/ruby32/share/ruby/error_highlight/core_ext.rb

require_relative "formatter"

module ErrorHighlight
  module CoreExt
    private def generate_snippet
      spot = ErrorHighlight.spot(self)
      return "" unless spot
      return ErrorHighlight.formatter.message_for(spot)
    end

    if Exception.method_defined?(:detailed_message)
      def detailed_message(highlight: false, error_highlight: true, **)
        return super unless error_highlight
        snippet = generate_snippet
        if highlight
          snippet = snippet.gsub(/.+/) { "\e[1m" + $& + "\e[m" }
        end
        super + snippet
      end
    else
      # This is a marker to let `DidYouMean::Correctable#original_message` skip
      # the following method definition of `to_s`.
      # See https://github.com/ruby/did_you_mean/pull/152
      SKIP_TO_S_FOR_SUPER_LOOKUP = true
      private_constant :SKIP_TO_S_FOR_SUPER_LOOKUP

      def to_s
        msg = super
        snippet = generate_snippet
        if snippet != "" && !msg.include?(snippet)
          msg + snippet
        else
          msg
        end
      end
    end
  end

  NameError.prepend(CoreExt)

  if Exception.method_defined?(:detailed_message)
    # ErrorHighlight is enabled for TypeError and ArgumentError only when Exception#detailed_message is available.
    # This is because changing ArgumentError#message is highly incompatible.
    TypeError.prepend(CoreExt)
    ArgumentError.prepend(CoreExt)
  end
end

SILENT KILLER Tool