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

add rr_define_const()

This commit is contained in:
Charles Lowell 2010-05-22 09:15:00 +03:00
parent c2309097b9
commit e6c6f4e04b
2 changed files with 11 additions and 0 deletions

View file

@ -17,6 +17,13 @@ VALUE rr_define_class(const char *name, VALUE superclass) {
return klass;
}
VALUE rr_define_const(const char *name, VALUE value) {
VALUE V8 = rb_define_module("V8");
VALUE V8_C = rb_define_module_under(V8, "C");
rb_define_const(V8_C, name, value);
return value;
}
VALUE rr_str_to_perl_case(VALUE str) {
VALUE V8 = rb_define_module("V8");
VALUE to = rb_define_module_under(V8, "To");
@ -30,6 +37,9 @@ VALUE rr_str_to_camel_case(VALUE str) {
}
VALUE rr_v82rb(Handle<Value> value) {
if (value.IsEmpty()) {
return rr_cV8_C_Empty;
}
if (value.IsEmpty() || value->IsUndefined() || value->IsNull()) {
return Qnil;
}

View file

@ -8,6 +8,7 @@
#define rr_define_singleton_method(object, name, impl, argc) rb_define_singleton_method(object, name, (VALUE(*)(...))impl, argc)
VALUE rr_define_class(const char *name, VALUE superclass = rb_cObject);
VALUE rr_define_const(const char *name, VALUE value);
VALUE rr_str_to_perl_case(VALUE str);
VALUE rr_str_to_camel_case(VALUE str);