Module: Rupy::Macros

Defined in:
lib/rupy/macros.rb

Overview

Contains Python C API macros reimplmented in Ruby. For internal use only.

Class Method Summary collapse

Class Method Details

.Py_FalseObject



24
25
26
# File 'lib/rupy/macros.rb', line 24

def self.Py_False
    Python.Py_ZeroStruct.to_ptr
end

.Py_NoneObject



28
29
30
# File 'lib/rupy/macros.rb', line 28

def self.Py_None
    Python.Py_NoneStruct.to_ptr
end

.Py_RETURN_FALSEObject



32
33
34
35
# File 'lib/rupy/macros.rb', line 32

def self.Py_RETURN_FALSE
    Python.Py_IncRef(self.Py_False)
    self.Py_False
end

.Py_RETURN_NONEObject



42
43
44
45
# File 'lib/rupy/macros.rb', line 42

def self.Py_RETURN_NONE
    Python.Py_IncRef(self.Py_None)
    self.Py_None
end

.Py_RETURN_TRUEObject



37
38
39
40
# File 'lib/rupy/macros.rb', line 37

def self.Py_RETURN_TRUE
    Python.Py_IncRef(self.Py_True)
    self.Py_True
end

.Py_TrueObject



20
21
22
# File 'lib/rupy/macros.rb', line 20

def self.Py_True
    Python.Py_TrueStruct.to_ptr
end

.Py_TYPE(pObjPointer) ⇒ Object



7
8
9
10
# File 'lib/rupy/macros.rb', line 7

def self.Py_TYPE(pObjPointer)
    pStruct = Python::PyObjectStruct.new pObjPointer
    pStruct[:ob_type]
end

.PyObject_TypeCheck(pObject, pTypePointer) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/rupy/macros.rb', line 12

def self.PyObject_TypeCheck(pObject, pTypePointer)
    if Py_TYPE(pObject) == pTypePointer
        1
    else
        0
    end
end