Sha256: 4c0147e685c07766880b3b66072f921d029c8ee07cebddc4be1d56e9753e2c8b
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
#include "v8_obj.h" #include "v8_ref.h" #include "converters.h" using namespace v8; #include <cstdio> VALUE V8_C_Object; namespace { Local<Object> unwrap(VALUE robj) { return V8_Ref_Get<Object>(robj); } } VALUE v8_Object_New(VALUE clazz) { HandleScope handles; return V8_Ref_Create(clazz, Object::New()); } VALUE v8_Object_Get(VALUE self, VALUE key) { HandleScope handles; Local<Object> obj = unwrap(self); VALUE keystr = rb_str_to_str(key); Local<Value> value = obj->Get(RB2V8(keystr)); return V82RB(value); } VALUE v8_Object_Set(VALUE self, VALUE key, VALUE value) { HandleScope handles; Local<Object> obj = unwrap(self); VALUE keystr = rb_funcall(key, rb_intern("to_s"), 0); obj->Set(RB2V8(keystr), RB2V8(value)); return Qnil; } VALUE v8_Object_GetPropertyNames(VALUE self) { HandleScope handles; Local<Object> object = unwrap(self); Local<Value> names = object->GetPropertyNames(); return V82RB(names); } VALUE v8_Object_context(VALUE self) { HandleScope handles; Local<Object> object = unwrap(self); Local<Value> cxt = object->GetHiddenValue(String::New("TheRubyRacer::Context")); return cxt.IsEmpty() ? Qnil : (VALUE)External::Unwrap(cxt); }
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
therubyracer-0.4.4 | ext/v8/v8_obj.cpp |