Esempio n. 1
0
RubyInterpreter::RubyInterpreter(Kross::Api::InterpreterInfo* info): Kross::Api::Interpreter(info)
{
#ifdef KROSS_RUBY_INTERPRETER_DEBUG
    krossdebug("RubyInterpreter::RubyInterpreter(info)");
#endif
    if(d == 0)
    {
        initRuby();
    }
    if(info->hasOption("safelevel") )
    {
        rb_set_safe_level( info->getOption("safelevel")->value.toInt() );
    } else {
        rb_set_safe_level(4); // if the safelevel option is undefined, set it to maximum level
    }
}
Esempio n. 2
0
static void init()
{
    ruby_init();
#if RUBY_VERSION_CODE >= 160
    ruby_init_loadpath();
#else
#if RUBY_VERSION_CODE >= 145
    rb_ary_push(rb_load_path, rb_str_new2("."));
#endif
#endif
    if (eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI)
	rb_set_safe_level(1);
    eruby_init();
}
Esempio n. 3
0
int
policy_init( const Pool *p )
{
  ruby_init();
  ruby_init_loadpath();
  rb_set_safe_level(0); //FIXME

  /* give the ruby code a name */
  ruby_script("satsolver_policy");

  cPolicy = rb_define_class( "SatPolicy", rb_cObject );

  /* load the policy implementation */
  rb_require( "satsolver_policy" );
  
  pool = p;

  return 0;
}