Class: Py
- Inherits:
-
Object
- Object
- Py
- Defined in:
- ext/rpy/rpy.c
Class Method Summary collapse
Class Method Details
.run(python, options) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'ext/rpy/rpy.c', line 59
static VALUE Python_run(VALUE self, VALUE python, VALUE options )
{
VALUE serialization = Qnil;
if( options && !NIL_P(options) ){
serialization = rb_hash_aref(options,rb_eval_string(":serialize"));
}
// call python
PyRun_SimpleString( RSTRING_PTR(python) );
if( NIL_P(serialization) ){
return Qnil;
}
return Python_marshal_with_yaml(self);
}
|
.start ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'ext/rpy/rpy.c', line 26
static VALUE Python_start(VALUE self)
{
/* Name the Python interpreter */
Py_SetProgramName("ruby-embedded");
/* Initialize the Python interpreter. Required. */
Py_Initialize();
/* load the python yaml library */
//PyImport_ImportModule("yaml");
PyRun_SimpleString( "import yaml" );
return Qnil;
}
|
.stop ⇒ Object
78 79 80 81 82 |
# File 'ext/rpy/rpy.c', line 78
static VALUE Python_stop(VALUE self)
{
Py_Finalize();
return Qnil;
}
|