Sha256: 6897506d0c3959804a56289c005d1cfd77eb26f7c52184152d26d98bb4016c52

Contents?: true

Size: 832 Bytes

Versions: 3

Compression:

Stored size: 832 Bytes

Contents

module GirFFI
  module Builder
    module Type
      class Base
        include BuilderHelper

        def initialize info
          @info = info
          @namespace = @info.namespace
          @classname = @info.name.gsub(/^(.)/) { $1.upcase }
        end

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

        private

        def info
          @info
        end

        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
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gir_ffi-0.0.13 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.0.12 lib/gir_ffi/builder/type/base.rb
gir_ffi-0.0.11 lib/gir_ffi/builder/type/base.rb