This file is indexed.

/usr/lib/ruby/vendor_ruby/moneta/optionmerger.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
module Moneta
  # @api private
  class OptionMerger < Wrapper
    METHODS = [:key?, :load, :store, :create, :delete, :increment, :clear].freeze

    attr_reader :default_options

    # @param [Moneta store] adapter underlying adapter
    # @param [Hash] options
    def initialize(adapter, options = {})
      super(adapter, options)

      @default_options = adapter.respond_to?(:default_options) ? adapter.default_options.dup : {}

      if options.include?(:only)
        raise ArgumentError, 'Either :only or :except is allowed' if options.include?(:except)
        methods = [options.delete(:only)].compact.flatten
      elsif options.include?(:except)
        methods = METHODS - [options.delete(:except)].compact.flatten
      else
        methods = METHODS
      end

      methods.each do |method|
        if oldopts = @default_options[method]
          newopts = (@default_options[method] = oldopts.merge(options))
          newopts[:prefix] = "#{oldopts[:prefix]}#{options[:prefix]}" if oldopts[:prefix] || options[:prefix]
        else
          @default_options[method] = options
        end
      end
    end

    protected

    def wrap(method, *args)
      options = args.last
      options.merge!(@default_options[method]) if Hash === options && @default_options.include?(method)
      yield
    end
  end
end