This file is indexed.

/usr/lib/ruby/vendor_ruby/web_console/session.rb is in ruby-web-console 2.2.1-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
module WebConsole
  # A session lets you persist wrap an +Evaluator+ instance in memory
  # associated with multiple bindings.
  #
  # Each newly created session is persisted into memory and you can find it
  # later its +id+.
  #
  # A session may be associated with multiple bindings. This is used by the
  # error pages only, as currently, this is the only client that needs to do
  # that.
  class Session
    cattr_reader :inmemory_storage
    @@inmemory_storage = {}

    class << self
      # Finds a persisted session in memory by its id.
      #
      # Returns a persisted session if found in memory.
      # Raises NotFound error unless found in memory.
      def find(id)
        inmemory_storage[id]
      end

      # Create a Session from an exception.
      def from_exception(exc)
        new(exc.bindings)
      end

      # Create a Session from a single binding.
      def from_binding(binding)
        new(binding)
      end
    end

    # An unique identifier for every REPL.
    attr_reader :id

    def initialize(bindings)
      @id = SecureRandom.hex(16)
      @bindings = Array(bindings)
      @evaluator = Evaluator.new(@bindings[0])

      store_into_memory
    end

    # Evaluate +input+ on the current Evaluator associated binding.
    #
    # Returns a string of the Evaluator output.
    def eval(input)
      @evaluator.eval(input)
    end

    # Switches the current binding to the one at specified +index+.
    #
    # Returns nothing.
    def switch_binding_to(index)
      @evaluator = Evaluator.new(@bindings[index.to_i])
    end

    private

      def store_into_memory
        inmemory_storage[id] = self
      end
  end
end