Sha256: ef70f2996a3f79b03739d2e27f7b054e2b54558c44a26e32ac9ab8dd1462342e

Contents?: true

Size: 968 Bytes

Versions: 9

Compression:

Stored size: 968 Bytes

Contents

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

module GirFFI
  # Builds a class based on information found in the introspection
  # repository.
  module Builder
    module Type
      TYPE_MAP = {
        :callback => Callback,
        :constant => Constant,
        :enum => Enum,
        :flags => Enum,
        :interface => Interface,
        :object => Object,
        :struct => Struct,
        :union => Union
      }

      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

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.4.1 lib/gir_ffi/builder/type.rb
gir_ffi-0.4.0 lib/gir_ffi/builder/type.rb
gir_ffi-0.3.2 lib/gir_ffi/builder/type.rb
gir_ffi-0.3.1 lib/gir_ffi/builder/type.rb
gir_ffi-0.3.0 lib/gir_ffi/builder/type.rb
gir_ffi-0.2.3 lib/gir_ffi/builder/type.rb
gir_ffi-0.2.2 lib/gir_ffi/builder/type.rb
gir_ffi-0.2.1 lib/gir_ffi/builder/type.rb
gir_ffi-0.2.0 lib/gir_ffi/builder/type.rb