Sha256: 50566d184c1c0db72ad33fdacab393415dd62d3015ab862ff8af11c66a095115

Contents?: true

Size: 699 Bytes

Versions: 3

Compression:

Stored size: 699 Bytes

Contents

module FFI
  class Buffer
    def self.__calc_size(type)
      if type.kind_of? Fixnum
        type
      elsif type.kind_of? Symbol
        FFI.type_size(type)
      else
        type.size
      end
    end
    def self.new(size, count=nil, clear=true)
      self.__alloc_inout(self.__calc_size(size), count, clear)
    end
    def self.alloc_in(size, count=nil, clear=true)
      self.__alloc_in(self.__calc_size(size), count, clear)
    end
    def self.alloc_out(size, count=nil, clear=true)
      self.__alloc_out(self.__calc_size(size), count, clear)
    end
    def self.alloc_inout(size, count=nil, clear=true)
      self.__alloc_inout(self.__calc_size(size), count, clear)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ffi-0.1.0 lib/ffi/buffer.rb
ffi-0.2.0 lib/ffi/buffer.rb
ffi-0.1.1 lib/ffi/buffer.rb