diff --git a/ext/v8/rr.cpp b/ext/v8/rr.cpp index fb359ff..4c74257 100644 --- a/ext/v8/rr.cpp +++ b/ext/v8/rr.cpp @@ -115,9 +115,10 @@ Handle rr_rb2v8(VALUE value) { return True(); case T_FALSE: return False(); + case T_DATA: + return V8_Ref_Get(value); case T_OBJECT: return rr_reflect_rb_object(value); - case T_DATA: case T_CLASS: case T_ICLASS: case T_MODULE: diff --git a/ext/v8/v8_func.cpp b/ext/v8/v8_func.cpp index a21fc9f..3599d72 100644 --- a/ext/v8/v8_func.cpp +++ b/ext/v8/v8_func.cpp @@ -30,7 +30,7 @@ namespace { cxt.Dispose(); } } else { - thisObject = V8_Ref_Get(recv); + thisObject = rr_rb2v8(recv)->ToObject(); } int f_argc = argc - 1; Local arguments[f_argc]; diff --git a/lib/v8/to.rb b/lib/v8/to.rb index 1b7beaa..d080d61 100644 --- a/lib/v8/to.rb +++ b/lib/v8/to.rb @@ -18,6 +18,7 @@ module V8 when String then C::String.new(value) when Proc then C::FunctionTemplate.new(&value).GetFunction() when Method then C::FunctionTemplate.new(&value.to_proc).GetFunction() + when V8::Object then value.instance_variable_get(:@native) else value end