Class: RubyPythonBridge::RubyPyObject

Inherits:
Object
  • Object
show all
Defined in:
ext/rubypython_bridge/rp_object.c,
lib/rubypython/wrapper_extensions.rb

Direct Known Subclasses

RubyPyClass, RubyPyFunction, RubyPyModule

Instance Method Summary collapse

Instance Method Details

#__nameObject

Returns the name of the Python object which this instance wraps.



61
62
63
64
65
66
67
68
69
70
71
# File 'ext/rubypython_bridge/rp_object.c', line 61

VALUE rp_obj_name(VALUE self)
{
	if(Py_IsInitialized())
	{
	PyObject *pObject;
	pObject=rp_obj_pobject(self);
	return ptor_obj(PyObject_GetAttrString(pObject,"__name__"));		
	}
	return rb_str_new2("__FREED__");

}

#free_pobjObject

Decreases the reference count on the object wrapped by this instance. This is used for cleanup in RubyPython.stop. RubyPyObject instance automatically decrease the reference count on their associated objects before they are garbage collected.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'ext/rubypython_bridge/rp_object.c', line 29

VALUE rp_obj_free_pobj(VALUE self)
{
	PObj *cself;
	Data_Get_Struct(self,PObj,cself);
	if(Py_IsInitialized()&&cself->pObject)
	{
		Py_XDECREF(cself->pObject);
		cself->pObject=NULL;
		return Qtrue;
	}
	return Qfalse;
}

#inspectObject



2
3
4
# File 'lib/rubypython/wrapper_extensions.rb', line 2

def inspect
  "<#{self.class}:  #{__name}>"
end