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

add conversion for fixnum

This commit is contained in:
Charles Lowell 2015-07-29 17:01:11 +03:00
parent 277926fc7f
commit 7c293f0b68
2 changed files with 15 additions and 9 deletions

View file

@ -45,6 +45,12 @@ class String
end
end
class Fixnum
def to_v8(context)
V8::C::Integer::New(context.isolate.native, self)
end
end
# for type in [TrueClass, FalseClass, NilClass, Float] do
# type.class_eval do
# include V8::Conversion::Primitive

View file

@ -84,15 +84,15 @@ describe "V8::Context" do
end
end
# xit "can pass int properties to ruby", :compat => '0.2.1' do
# @cxt.eval("({ 4: '4', 5: 5, '6': true })").tap do |object|
# object[ 4 ].should == '4'
# object['4'].should == '4'
# object[ 5 ].should == 5
# object['5'].should == 5
# object['6'].should == true
# end
# end
it "can pass int properties to ruby", :compat => '0.2.1' do
@cxt.eval("({ 4: '4', 5: 5, '6': true })").tap do |object|
object[ 4 ].should == '4'
object['4'].should == '4'
object[ 5 ].should == 5
object['5'].should == 5
object['6'].should == true
end
end
# xit "unwraps ruby objects returned by embedded ruby code to maintain referential integrity" do
# Object.new.tap do |o|