This file is indexed.

/usr/lib/ruby/vendor_ruby/pry/commands/cat/exception_formatter.rb is in pry 0.10.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class Pry
  class Command::Cat
    class ExceptionFormatter < AbstractFormatter
      attr_reader :ex
      attr_reader :opts
      attr_reader :_pry_

      def initialize(exception, _pry_, opts)
        @ex = exception
        @opts = opts
        @_pry_ = _pry_
      end

      def format
        check_for_errors
        set_file_and_dir_locals(backtrace_file, _pry_, _pry_.current_context)
        code = decorate(Pry::Code.from_file(backtrace_file).
                                    between(*start_and_end_line_for_code_window).
                                    with_marker(backtrace_line))
        "#{header}#{code}"
      end

      private

      def code_window_size
        _pry_.config.default_window_size || 5
      end

      def backtrace_level
        return @backtrace_level if @backtrace_level

        bl =  if opts[:ex].nil?
                ex.bt_index
              else
                ex.bt_index = absolute_index_number(opts[:ex], ex.backtrace.size)
              end

        increment_backtrace_level
        @backtrace_level = bl
      end

      def increment_backtrace_level
        ex.inc_bt_index
      end

      def backtrace_file
        Array(ex.bt_source_location_for(backtrace_level)).first
      end

      def backtrace_line
        Array(ex.bt_source_location_for(backtrace_level)).last
      end

      def check_for_errors
        raise CommandError, "No exception found." unless ex
        raise CommandError, "The given backtrace level is out of bounds." unless backtrace_file
      end

      def start_and_end_line_for_code_window
        start_line = backtrace_line - code_window_size
        start_line = 1 if start_line < 1

        [start_line, backtrace_line + code_window_size]
      end

      def header
        unindent %{
        #{Helpers::Text.bold 'Exception:'} #{ex.class}: #{ex.message}
        --
        #{Helpers::Text.bold('From:')} #{backtrace_file} @ line #{backtrace_line} @ #{Helpers::Text.bold("level: #{backtrace_level}")} of backtrace (of #{ex.backtrace.size - 1}).

      }
      end

    end
  end
end