Sha256: b36744dee4e583c2ca45f6c3f52c060dae10f2b66d41e5eac86f19b234dc7852

Contents?: true

Size: 1.46 KB

Versions: 10

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

require "gir_ffi/builders/callback_builder"
require "gir_ffi/builders/constant_builder"
require "gir_ffi/builders/enum_builder"
require "gir_ffi/builders/flags_builder"
require "gir_ffi/builders/interface_builder"
require "gir_ffi/builders/object_builder"
require "gir_ffi/builders/struct_builder"
require "gir_ffi/builders/signal_closure_builder"
require "gir_ffi/builders/unintrospectable_boxed_builder"
require "gir_ffi/builders/unintrospectable_builder"
require "gir_ffi/builders/union_builder"
require "gir_ffi/builders/vfunc_builder"

module GirFFI
  module Builders
    # Builds a class based on information found in the introspection
    # repository.
    module TypeBuilder
      CACHE = {}

      TYPE_MAP = {
        callback:               CallbackBuilder,
        constant:               ConstantBuilder,
        enum:                   EnumBuilder,
        flags:                  FlagsBuilder,
        interface:              InterfaceBuilder,
        object:                 ObjectBuilder,
        struct:                 StructBuilder,
        union:                  UnionBuilder,
        unintrospectable_boxed: UnintrospectableBoxedBuilder,
        unintrospectable:       UnintrospectableBuilder
      }.freeze

      def self.build(info)
        builder_for(info).build_class
      end

      # TODO: Pull up to include :function and :module
      def self.builder_for(info)
        TYPE_MAP[info.info_type].new(info)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gir_ffi-0.15.9 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.8 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.7 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.6 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.5 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.4 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.3 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.2 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.1 lib/gir_ffi/builders/type_builder.rb
gir_ffi-0.15.0 lib/gir_ffi/builders/type_builder.rb