This file is indexed.

/usr/lib/ruby/vendor_ruby/gir_ffi/builders/constructor_builder.rb is in ruby-gir-ffi 0.9.0-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
require 'gir_ffi/builders/argument_builder_collection'
require 'gir_ffi/builders/method_template'
require 'gir_ffi/builders/null_return_value_builder'

module GirFFI
  module Builders
    # Implements the creation of a Ruby constructor definition out of a
    # GIR IFunctionInfo.
    class ConstructorBuilder
      def initialize(info)
        @info = info
        return_value_builder = NullReturnValueBuilder.new
        arg_builders = ArgumentBuilderCollection.new(return_value_builder, [])
        @template = MethodTemplate.new(self, arg_builders)
      end

      def method_definition
        @template.method_definition
      end

      def singleton_method?
        true
      end

      def method_name
        @info.safe_name
      end

      def method_arguments
        ['*args', '&block']
      end

      def preparation
        if @info.safe_name == 'new'
          ['obj = allocate']
        else
          [
            "raise NoMethodError unless self == #{@info.container.full_type_name}",
            'obj = allocate'
          ]
        end
      end

      def invocation
        "obj.__send__ #{initializer_name.to_sym.inspect}, #{method_arguments.join(', ')}"
      end

      def result
        ['obj']
      end

      private

      def initializer_name
        @info.safe_name.sub(/^new/, 'initialize')
      end
    end
  end
end