Sha256: 1de8ea3124ce8b1164b33f2526959673c6a8ab1db33838391a9c7035d23b7bf6

Contents?: true

Size: 621 Bytes

Versions: 21

Compression:

Stored size: 621 Bytes

Contents

require 'ffi'

module PyCall
  module LibPython
    class PyObjectStruct < FFI::Struct
    end

    class PyTypeObjectStruct < PyObjectStruct
    end

    class PyObjectStruct < FFI::Struct
      layout ob_refcnt: :ssize_t,
             ob_type:   PyTypeObjectStruct.by_ref

      def self.null
        new(FFI::Pointer::NULL)
      end

      def py_none?
        PyCall.none?(self)
      end

      def kind_of?(klass)
        klass = klass.__pyobj__ if klass.kind_of? PyObjectWrapper
        return super unless klass.kind_of? PyObjectStruct
        PyCall::Types.pyisinstance(self, klass)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
pycall-1.5.1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.5.0 lib/pycall/libpython/pyobject_struct.rb
pycall-1.4.2 lib/pycall/libpython/pyobject_struct.rb
pycall-1.4.1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.4.0 lib/pycall/libpython/pyobject_struct.rb
pycall-1.3.1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.3.0 lib/pycall/libpython/pyobject_struct.rb
pycall-1.3.0.dev lib/pycall/libpython/pyobject_struct.rb
pycall-1.2.1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.2.0 lib/pycall/libpython/pyobject_struct.rb
pycall-1.2.0.beta1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.1.0.rc1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.3 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.2-x86-mingw32 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.2-x64-mingw32 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.2 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.1-x86-mingw32 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.1-x64-mingw32 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.1 lib/pycall/libpython/pyobject_struct.rb
pycall-1.0.0 lib/pycall/libpython/pyobject_struct.rb