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:06 -05:00

24 lines
No EOL
425 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() {
ClassBuilder("Script").
defineSingletonMethod("New", &New).
defineMethod("Run", &Run);
}
}