This file is indexed.

/usr/lib/ruby/vendor_ruby/fakeredis/expiring_hash.rb is in ruby-fakeredis 0.5.0-1.

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
module FakeRedis
  # Represents a normal hash with some additional expiration information
  # associated with each key
  class ExpiringHash < Hash
    attr_reader :expires

    def initialize(*)
      super
      @expires = {}
    end

    def [](key)
      key = normalize key
      delete(key) if expired?(key)
      super
    end

    def []=(key, val)
      key = normalize key
      expire(key)
      super
    end

    def delete(key)
      key = normalize key
      expire(key)
      super
    end

    def expire(key)
      key = normalize key
      expires.delete(key)
    end

    def expired?(key)
      key = normalize key
      expires.include?(key) && expires[key] < Time.now
    end

    def key?(key)
      key = normalize key
      delete(key) if expired?(key)
      super
    end

    def values_at(*keys)
      keys.each do |key|
        key = normalize(key)
        delete(key) if expired?(key)
      end
      super
    end

    def keys
      super.select do |key|
        key = normalize(key)
        if expired?(key)
          delete(key)
          false
        else
          true
        end
      end
    end

    def normalize key
      key.to_s
    end
  end
end