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

24 lines
425 B
C++
Raw Normal View History

2012-05-02 19:15:11 -04:00
#include "rr.h"
namespace rr {
namespace {
VALUE New(VALUE klass, VALUE source, VALUE filename) {
v8::HandleScope scope;
2012-05-03 03:31:23 -04:00
return Script::create(v8::Script::New(String(source), Value(filename)), klass);
2012-05-02 19:15:11 -04:00
}
VALUE Run(VALUE self) {
v8::HandleScope scope;
return Value(Script(self)->Run());
}
}
void Script::Init() {
ClassBuilder("Script").
defineSingletonMethod("New", &New).
defineMethod("Run", &Run);
2012-05-02 19:15:11 -04:00
}
}