Sha256: 520298fc636311c1878d0ae0bb173119be24b815ef3ad13c265b64d030675882

Contents?: true

Size: 920 Bytes

Versions: 10

Compression:

Stored size: 920 Bytes

Contents

module GirFFI
  module Builder
    module Type

      # Base class for type builders.
      class Base
        include BuilderHelper

        def initialize info
          @info = info
          @namespace = @info.namespace
          @classname = @info.safe_name
        end

        def build_class
          unless defined? @klass
            instantiate_class
          end
          @klass
        end

        attr_reader :info

        private

        def namespace_module
          @namespace_module ||= Builder.build_module @namespace
        end

        def lib
          @lib ||= namespace_module.const_get :Lib
        end

        def get_or_define_class namespace, name, parent
          optionally_define_constant(namespace, name) {
            Class.new parent
          }
        end

        def gir
          @gir ||= GObjectIntrospection::IRepository.default
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gir_ffi-0.5.2 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.5.1 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.5.0 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.4.3 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.4.2 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.4.1 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.4.0 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.3.2 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.3.1 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.3.0 lib/gir_ffi/builder/type/base.rb