diff --git a/lib/v8/conversion.rb b/lib/v8/conversion.rb index 8f08c9a..656fa0b 100644 --- a/lib/v8/conversion.rb +++ b/lib/v8/conversion.rb @@ -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 diff --git a/spec/v8/context_spec.rb b/spec/v8/context_spec.rb index e996677..3b2b7e2 100644 --- a/spec/v8/context_spec.rb +++ b/spec/v8/context_spec.rb @@ -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|