Module: RubyPythonBridge
- Defined in:
- ext/rubypython_bridge/rubypython_bridge.c
Defined Under Namespace
Classes: BlankObject, RubyPyClass, RubyPyFunction, RubyPyInstance, RubyPyModule, RubyPyObject
Class Method Summary collapse
-
.func(modname, funcname, *args) ⇒ Object
Given a python module name modname and a function name funcname calls the given function with the supplied arguments.
-
.import(modname) ⇒ Object
Imports the python module modname using the interpreter and returns a ruby wrapper.
-
.start ⇒ Object
Starts the python interpreter.
-
.stop ⇒ Object
Stop the python interpreter.
Class Method Details
.func(modname, funcname, *args) ⇒ Object
Given a python module name modname and a function name funcname calls the given function with the supplied arguments.
Use builtins as the module for a built in function.
18 19 20 21 22 23 24 25 26 27 28 |
# File 'ext/rubypython_bridge/rubypython_bridge.c', line 18
static VALUE func_with_module(VALUE self, VALUE args)
{
int started_here=safe_start();
VALUE module,func,return_val;
if(RARRAY(args)->len<2) return Qfalse;
module=rb_ary_shift(args);
func=rb_ary_shift(args);
return_val=rp_call_func_with_module_name(module,func,args);
safe_stop(started_here);
return return_val;
}
|
.import(modname) ⇒ Object
Imports the python module modname using the interpreter and returns a ruby wrapper
35 36 37 38 |
# File 'ext/rubypython_bridge/rubypython_bridge.c', line 35
static VALUE rp_import(VALUE self,VALUE mname)
{
return rb_class_new_instance(1,&mname,cRubyPyModule);
}
|
.start ⇒ Object
Starts the python interpreter
45 46 47 48 49 50 51 52 53 54 55 |
# File 'ext/rubypython_bridge/rubypython_bridge.c', line 45
VALUE rp_start(VALUE self)
{
if(Py_IsInitialized())
{
return Qfalse;
}
Py_Initialize();
return Qtrue;
}
|
.stop ⇒ Object
Stop the python interpreter
62 63 64 65 66 67 68 69 70 71 72 |
# File 'ext/rubypython_bridge/rubypython_bridge.c', line 62
VALUE rp_stop(VALUE self)
{
if(Py_IsInitialized())
{
Py_Finalize();
return Qtrue;
}
return Qfalse;
}
|