Sha256: 7e7ef02e1eaf8e2974c5b3d7a1af8d395ef70aa47c2739b3175c9a0bb9a4effc

Contents?: true

Size: 773 Bytes

Versions: 2

Compression:

Stored size: 773 Bytes

Contents

require 'gir_ffi/builder/type/registered_type'
module GirFFI
  module Builder
    module Type

      # Implements the creation of a class representing union type. The
      # class will have a nested FFI::Union class to represent its C union.
      class Union < RegisteredType
        def build_class
          unless defined? @klass
            instantiate_union_class
          end
          @klass
        end

        def instantiate_union_class
          @klass = get_or_define_class namespace_module, @classname, superclass
          @structklass = get_or_define_class @klass, :Struct, FFI::Union
          setup_class unless already_set_up
        end

        def setup_class
          super
          provide_constructor
        end
      end
    end
  end
end


Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.0.10 lib/gir_ffi/builder/type/union.rb
gir_ffi-0.0.9 lib/gir_ffi/builder/type/union.rb