mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
make all native classes have a private new
This commit is contained in:
parent
2057383dfe
commit
1f9a375571
4 changed files with 5 additions and 4 deletions
|
@ -12,7 +12,9 @@ using namespace v8;
|
|||
VALUE rr_define_class(const char *name, VALUE superclass) {
|
||||
VALUE V8 = rb_define_module("V8");
|
||||
VALUE V8_C = rb_define_module_under(V8, "C");
|
||||
return rb_define_class_under(V8_C, name, superclass);
|
||||
VALUE klass = rb_define_class_under(V8_C, name, superclass);
|
||||
rb_funcall(klass, rb_intern("private_class_method"), 1, rb_str_new2("new"));
|
||||
return klass;
|
||||
}
|
||||
|
||||
VALUE rr_str_to_perl_case(VALUE str) {
|
||||
|
|
|
@ -77,7 +77,6 @@ namespace {
|
|||
|
||||
void rr_init_cxt() {
|
||||
VALUE ContextClass = V8_C_Context = rr_define_class("Context");
|
||||
rr_define_singleton_method(ContextClass, "new", New, -1);
|
||||
rr_define_singleton_method(ContextClass, "New", New, -1);
|
||||
rr_define_singleton_method(ContextClass, "InContext", InContext, 0);
|
||||
rr_define_singleton_method(ContextClass, "GetEntered", GetEntered, 0);
|
||||
|
|
|
@ -30,7 +30,7 @@ namespace {
|
|||
void rr_init_obj() {
|
||||
rr_cV8_C_Object = rr_define_class("Object", rr_cV8_C_Value);
|
||||
rb_define_attr(rr_cV8_C_Object, "context", 1, 0);
|
||||
rr_define_singleton_method(rr_cV8_C_Object, "new", v8_Object_New, 0);
|
||||
rr_define_singleton_method(rr_cV8_C_Object, "New", v8_Object_New, 0);
|
||||
rr_define_method(rr_cV8_C_Object, "Get", Get, 1);
|
||||
rr_define_method(rr_cV8_C_Object, "Set", v8_Object_Set, 2);
|
||||
rr_define_method(rr_cV8_C_Object, "GetPropertyNames", v8_Object_GetPropertyNames, 0);
|
||||
|
|
|
@ -4,7 +4,7 @@ module V8
|
|||
class Context
|
||||
attr_reader :native
|
||||
def initialize(opts = {})
|
||||
@native = C::Context.new(opts[:with])
|
||||
@native = C::Context::New(opts[:with])
|
||||
end
|
||||
|
||||
def open
|
||||
|
|
Loading…
Add table
Reference in a new issue