This file is indexed.

/usr/lib/ruby/vendor_ruby/moneta/adapters/pstore.rb is in ruby-moneta 0.7.20-2.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
78
79
80
81
82
83
84
85
86
87
88
require 'pstore'
require 'fileutils'

module Moneta
  module Adapters
    # PStore backend
    # @api public
    class PStore
      include Defaults

      supports :create, :increment
      attr_reader :backend

      # @param [Hash] options
      # @option options [String] :file PStore file
      # @option options [::PStore] :backend Use existing backend instance
      def initialize(options = {})
        @backend = options[:backend] ||
          begin
            raise ArgumentError, 'Option :file is required' unless options[:file]
            FileUtils.mkpath(::File.dirname(options[:file]))
            new_store(options)
          end
      end

      # (see Proxy#key?)
      def key?(key, options = {})
        @backend.transaction(true) { @backend.root?(key) }
      end

      # (see Proxy#load)
      def load(key, options = {})
        @backend.transaction(true) { @backend[key] }
      end

      # (see Proxy#store)
      def store(key, value, options = {})
        @backend.transaction { @backend[key] = value }
      end

      # (see Proxy#delete)
      def delete(key, options = {})
        @backend.transaction { @backend.delete(key) }
      end

      # (see Proxy#increment)
      def increment(key, amount = 1, options = {})
        @backend.transaction do
          value = Utils.to_int(@backend[key]) + amount
          @backend[key] = value.to_s
          value
        end
      end

      # (see Proxy#create)
      def create(key, value, options = {})
        @backend.transaction do
          if @backend.root?(key)
            false
          else
            @backend[key] = value
            true
          end
        end
      end

      # (see Proxy#clear)
      def clear(options = {})
        @backend.transaction do
          @backend.roots.each do |key|
            @backend.delete(key)
          end
        end
        self
      end

      protected

      def new_store(options)
        if RUBY_VERSION > '1.9'
          ::PStore.new(options[:file], options[:threadsafe])
        else
          ::PStore.new(options[:file])
        end
      end
    end
  end
end