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

map ruby arrays by value to javascript arrays

This commit is contained in:
Charles Lowell 2010-05-23 05:31:36 +03:00
parent c425c42ad9
commit 90e7e824d0
3 changed files with 8 additions and 1 deletions

View file

@ -23,6 +23,7 @@ namespace {
if (NIL_P(length)) {
length = INT2FIX(0);
}
HandleScope scope;
return V8_Ref_Create(self, Array::New(NUM2INT(length)));
}

View file

@ -35,6 +35,12 @@ module V8
To.v8(value.call(*rbargs))
end
return template.GetFunction()
when ::Array
C::Array::New(value.length).tap do |a|
value.each_with_index do |item, i|
a.Set(i, To.v8(item))
end
end
when nil,Numeric
value
else

@ -1 +1 @@
Subproject commit a3705dc106c37314c7da403e05062268d331d9dd
Subproject commit b74190886c2a7c8ff33fc4d927162d068fc9802e