This file is indexed.

/usr/lib/ruby/vendor_ruby/gir_ffi/builders/registered_type_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
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
require 'gir_ffi/builders/base_type_builder'
require 'gir_ffi/method_stubber'
require 'gir_ffi/builders/function_builder'
require 'gir_ffi/builders/constructor_builder'
require 'gir_ffi/builders/initializer_builder'

module GirFFI
  module Builders
    # Base class for type builders building types specified by subtypes
    # of IRegisteredTypeInfo. These are types whose C representation is
    # complex, i.e., a struct or a union.
    class RegisteredTypeBuilder < BaseTypeBuilder
      def setup_method(method)
        method_info = info.find_method method
        return unless method_info
        attach_and_define_method method_info, meta_class
      end

      def setup_instance_method(method)
        method_info = info.find_instance_method method
        return unless method_info
        attach_and_define_method method_info, build_class
      end

      def target_gtype
        info.g_type
      end

      private

      def meta_class
        (class << build_class; self; end)
      end

      def attach_and_define_method(method_info, modul)
        method = method_info.safe_name
        attach_method method_info
        remove_old_method method, modul
        define_method method_info
        method
      end

      def define_method(method_info)
        if method_info.constructor?
          initializer_builder = InitializerBuilder.new(method_info)
          initializer_name = initializer_builder.method_name.to_sym
          unless build_class.private_instance_methods(false).include? initializer_name
            build_class.class_eval initializer_builder.method_definition
          end
          build_class.class_eval ConstructorBuilder.new(method_info).method_definition
        else
          build_class.class_eval FunctionBuilder.new(method_info).method_definition
        end
      end

      def remove_old_method(method, modul)
        modul.class_eval { remove_method method if method_defined? method }
      end

      def attach_method(method_info)
        Builder.attach_ffi_function lib, method_info
      end

      def stub_methods
        info.get_methods.each do |minfo|
          klass.class_eval MethodStubber.new(minfo).method_stub
        end
      end

      def setup_constants
        klass.const_set :G_TYPE, target_gtype
        super
      end

      def parent_info
        nil
      end

      def fields
        info.fields
      end
    end
  end
end