Class: RubyPythonBridge::RubyPyModule

Inherits:
RubyPyObject show all
Defined in:
lib/rubypython/wrapper_extensions.rb,
ext/rubypython_bridge/rp_module.c

Overview

A wrapper class for Python Modules.

Methods calls are delegated to the equivalent Python methods/functions. Attribute references return either the equivalent attribute converted to a native Ruby type, or wrapped reference to a Python object. RubyPyModule instances should be created through the use of RubyPython.import.

Instance Method Summary collapse

Methods inherited from RubyPyObject

#__name, #free_pobj, #inspect, #respond_to?

Constructor Details

#initialize(mname) ⇒ Object

:nodoc:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'ext/rubypython_bridge/rp_module.c', line 30

static
VALUE rpModuleInit(VALUE self, VALUE mname)
{
	PObj* cself;
	VALUE rDict;
	PyObject *pModuleDict;
	
	Data_Get_Struct(self, PObj, cself);
	cself->pObject = rpGetModule(mname);
	
	pModuleDict = PyModule_GetDict(cself->pObject);
	Py_XINCREF(pModuleDict);
	
	rDict = rpObjectFromPyObject(pModuleDict);
	
	rb_iv_set(self,"@pdict", rDict);
	
	return self;
}