From 22519a4605dbf0f6b2af1314a7d5bcd58831094a Mon Sep 17 00:00:00 2001 From: Bill Robertson Date: Fri, 25 Dec 2009 21:59:46 -0500 Subject: [PATCH] make it compile --- ext/v8/convert_ruby.h | 15 +++++++++------ ext/v8/v8_obj.cpp | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ext/v8/convert_ruby.h b/ext/v8/convert_ruby.h index a4354fb..2131e37 100644 --- a/ext/v8/convert_ruby.h +++ b/ext/v8/convert_ruby.h @@ -45,12 +45,15 @@ template class RubyValueSource { case T_FALSE: return dest.pushBool(false); case T_DATA: - VALUE clsProc = rb_eval("::Proc"); - VALUE clsMethod = rb_eval("::Method"); - VALUE smartMatch = rb_intern("==="); - if (RTEST(rb_funcall(clsProc, smartMatch, value)) || RTEST(rbfuncall(clsMethod, smartMatch, value))) { - - } +/* + VALUE clsProc = rb_eval_string("::Proc"); + VALUE clsMethod = rb_eval_string("::Method"); + VALUE smartMatch = rb_intern("==="); + if (RTEST(rb_funcall(clsProc, smartMatch, value)) || RTEST(rb_funcall(clsMethod, smartMatch, value))) { + + } +*/ + break; } return dest.pushUndefined(); } diff --git a/ext/v8/v8_obj.cpp b/ext/v8/v8_obj.cpp index ccb64e4..5f0c8fa 100644 --- a/ext/v8/v8_obj.cpp +++ b/ext/v8/v8_obj.cpp @@ -4,6 +4,8 @@ using namespace v8; +#include + VALUE V8_C_Object; VALUE v8_Object_New(VALUE clazz) { @@ -21,9 +23,17 @@ VALUE v8_Object_Get(VALUE self, VALUE key) { VALUE v8_Object_Set(VALUE self, VALUE key, VALUE value) { HandleScope handles; - convert_rb_to_v8_t rb2v8; Local obj = V8_Ref_Get(self); VALUE keystr = rb_funcall(key, rb_intern("to_s"), 0); - obj->Set(rb2v8(keystr), rb2v8(value)); + + VALUE valueClass = rb_class_of(value); + if(valueClass == rb_cProc) { + printf("** This is a proc! We should do something different.\n"); + } + else if(valueClass == rb_cMethod) { + printf("** This is a method! We should do something different.\n"); + } + + obj->Set(RB2V8(keystr), RB2V8(value)); return Qnil; }