Sha256: d9cbaff187dade41ff9cce16fa727f4a67cde30af1c7911354afd67f207ff9cd

Contents?: true

Size: 1012 Bytes

Versions: 7

Compression:

Stored size: 1012 Bytes

Contents

require 'gir_ffi/builder/type/callback'
require 'gir_ffi/builder/type/constant'
require 'gir_ffi/builder/type/enum'
require 'gir_ffi/builder/type/interface'
require 'gir_ffi/builder/type/object'
require 'gir_ffi/builder/type/struct'
require 'gir_ffi/builder/type/unintrospectable'
require 'gir_ffi/builder/type/union'

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

      TYPE_MAP = {
        :callback => Callback,
        :constant => Constant,
        :enum => Enum,
        :flags => Enum,
        :interface => Interface,
        :object => Object,
        :struct => Struct,
        :union => Union,
        :unintrospectable => Unintrospectable
      }

      def self.build info
        TYPE_MAP[info.info_type].new(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

7 entries across 7 versions & 1 rubygems

Version Path
gir_ffi-0.6.6 lib/gir_ffi/builder/type.rb
gir_ffi-0.6.5 lib/gir_ffi/builder/type.rb
gir_ffi-0.6.4 lib/gir_ffi/builder/type.rb
gir_ffi-0.6.3 lib/gir_ffi/builder/type.rb
gir_ffi-0.6.2 lib/gir_ffi/builder/type.rb
gir_ffi-0.6.1 lib/gir_ffi/builder/type.rb
gir_ffi-0.6.0 lib/gir_ffi/builder/type.rb