Sha256: 5e9c77a10706abc61492820f929181a2ffc1d169a202575fa5407eae316fe0de

Contents?: true

Size: 986 Bytes

Versions: 5

Compression:

Stored size: 986 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
      CACHE = {}

      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

5 entries across 5 versions & 1 rubygems

Version Path
gir_ffi-0.5.2 lib/gir_ffi/builder/type.rb
gir_ffi-0.5.1 lib/gir_ffi/builder/type.rb
gir_ffi-0.5.0 lib/gir_ffi/builder/type.rb
gir_ffi-0.4.3 lib/gir_ffi/builder/type.rb
gir_ffi-0.4.2 lib/gir_ffi/builder/type.rb