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:
parent
c2309097b9
commit
e6c6f4e04b
2 changed files with 11 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue