mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
24 lines
No EOL
481 B
C++
24 lines
No EOL
481 B
C++
#include "rr.h"
|
|
|
|
namespace rr {
|
|
namespace {
|
|
|
|
VALUE New(VALUE klass, VALUE source, VALUE filename) {
|
|
v8::HandleScope scope;
|
|
return Script::create(v8::Script::New(String(source), Value(filename)), klass);
|
|
}
|
|
|
|
VALUE Run(VALUE self) {
|
|
v8::HandleScope scope;
|
|
return Value(Script(self)->Run());
|
|
}
|
|
|
|
}
|
|
|
|
void Script::Init() {
|
|
VALUE ScriptClass = defineClass("Script");
|
|
RR_DEFINE_SINGLETON_METHOD(ScriptClass, "New", &New, 2);
|
|
RR_DEFINE_METHOD(ScriptClass, "Run", &Run, 0);
|
|
}
|
|
|
|
} |