1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/ext/v8/script.cc
2012-05-09 14:46:05 -05:00

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);
}
}