This file is indexed.

/usr/lib/ruby/vendor_ruby/naught/null_class_builder/commands/mimic.rb is in ruby-naught 1.0.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
require 'naught/basic_object'
require 'naught/null_class_builder/command'

module Naught::NullClassBuilder::Commands
  class Mimic < Naught::NullClassBuilder::Command
    attr_reader :class_to_mimic, :include_super

    def initialize(builder, class_to_mimic, options = {})
      super(builder)

      @class_to_mimic = class_to_mimic
      @include_super = options.fetch(:include_super) { true }

      builder.base_class   = root_class_of(class_to_mimic)
      builder.inspect_proc = lambda { "<null:#{class_to_mimic}>" }
      builder.interface_defined = true
    end

    def call
      defer do |subject|
        methods_to_stub.each do |method_name|
          builder.stub_method(subject, method_name)
        end
      end
    end

    private

    def root_class_of(klass)
      klass.ancestors.include?(Object) ? Object : Naught::BasicObject
    end

    def methods_to_stub
      class_to_mimic.instance_methods(include_super) - Object.instance_methods
    end
  end
end