mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
added access to String::NewSymbol()
This commit is contained in:
parent
fa093126a0
commit
c27f18f0be
1 changed files with 5 additions and 0 deletions
|
@ -17,6 +17,10 @@ namespace {
|
||||||
VALUE str = rb_funcall(data, rb_intern("to_s"), 0);
|
VALUE str = rb_funcall(data, rb_intern("to_s"), 0);
|
||||||
return rr_v8_ref_create(StringClass, String::New(RSTRING_PTR(str), RSTRING_LEN(str)));
|
return rr_v8_ref_create(StringClass, String::New(RSTRING_PTR(str), RSTRING_LEN(str)));
|
||||||
}
|
}
|
||||||
|
VALUE NewSymbol(VALUE rbclass, VALUE data) {
|
||||||
|
VALUE str = rb_funcall(data, rb_intern("to_s"), 0);
|
||||||
|
return rr_v8_ref_create(StringClass, String::NewSymbol(RSTRING_PTR(str), RSTRING_LEN(str)))
|
||||||
|
}
|
||||||
VALUE Utf8Value(VALUE self) {
|
VALUE Utf8Value(VALUE self) {
|
||||||
HandleScope handles;
|
HandleScope handles;
|
||||||
return rb_str_new2(*String::Utf8Value(unwrap(self)));
|
return rb_str_new2(*String::Utf8Value(unwrap(self)));
|
||||||
|
@ -40,6 +44,7 @@ VALUE rr_reflect_v8_string(Handle<Value> value) {
|
||||||
void rr_init_str() {
|
void rr_init_str() {
|
||||||
StringClass = rr_define_class("String", rr_cV8_C_Value);
|
StringClass = rr_define_class("String", rr_cV8_C_Value);
|
||||||
rr_define_singleton_method(StringClass, "New", New, 1);
|
rr_define_singleton_method(StringClass, "New", New, 1);
|
||||||
|
rr_define_singleton_method(StringClass, "NewSymbol", NewSymbol, 1)
|
||||||
rr_define_method(StringClass, "Utf8Value", Utf8Value, 0);
|
rr_define_method(StringClass, "Utf8Value", Utf8Value, 0);
|
||||||
rr_define_method(StringClass, "Utf16Value", Utf16Value, 0);
|
rr_define_method(StringClass, "Utf16Value", Utf16Value, 0);
|
||||||
rr_define_method(StringClass, "AsciiValue", AsciiValue, 0);
|
rr_define_method(StringClass, "AsciiValue", AsciiValue, 0);
|
||||||
|
|
Loading…
Reference in a new issue