Sha256: ec366a52c778042a8e2f42c0d299876e109d0cf36bbc1f7e084fef2c76093259

Contents?: true

Size: 397 Bytes

Versions: 1

Compression:

Stored size: 397 Bytes

Contents

require 'forwardable'
module GirFFI
  class Base
    extend Forwardable
    def_delegators :@struct, :[], :[]=, :to_ptr

    def initialize(ptr=nil)
      @struct = ptr.nil? ?
	self.ffi_structure.new :
	self.ffi_structure.new(ptr)
    end

    def ffi_structure
      self.class.ffi_structure
    end

    class << self
      def ffi_structure
	self.const_get(:Struct)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gir_ffi-0.0.1 lib/gir_ffi/base.rb