mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
17 lines
363 B
C++
17 lines
363 B
C++
|
|
#include "v8_str.h"
|
|
#include "v8.h"
|
|
#include "v8_ref.h"
|
|
|
|
using namespace v8;
|
|
|
|
VALUE v8_str_new(VALUE clazz, VALUE str) {
|
|
HandleScope handles;
|
|
return V8_Ref_Create(clazz, String::New(RSTRING(str)->ptr));
|
|
}
|
|
|
|
VALUE v8_str_to_s(VALUE self){
|
|
HandleScope handles;
|
|
Local<String> str = V8_Ref_Get<String>(self);
|
|
return rb_str_new2(*String::AsciiValue(str));
|
|
}
|