1
0
Fork 0
mirror of https://github.com/rubyjs/therubyracer synced 2023-03-27 23:21:42 -04:00
therubyracer/v8_script.cpp

24 lines
517 B
C++
Raw Normal View History

2009-12-07 16:06:06 +02:00
#include "v8.h"
#include "v8_ref.h"
#include "v8_script.h"
#include "v8_context.h"
#include "ruby_data.h"
#include "v8_data.h"
using namespace v8;
VALUE v8_script_new(VALUE self, VALUE source) {
HandleScope handles;
V8_Ref_Get(String, src, source);
return V8_Ref_Create(self, Script::New(src));
2009-12-07 16:06:06 +02:00
}
VALUE v8_script_Run(VALUE self) {
HandleScope handles;
V8_Ref_Get(Script, script, self);
2009-12-07 16:06:06 +02:00
V8HandleSource<RubyDest, VALUE> toValue;
Local<Value> result = script->Run();
return toValue.push(result);
}