diff options
-rw-r--r-- | lib/ffi_yajl/ffi/parser.rb | 2 | ||||
-rw-r--r-- | spec/ffi_yajl/parser_spec.rb | 1 |
2 files changed, 1 insertions, 2 deletions
diff --git a/lib/ffi_yajl/ffi/parser.rb b/lib/ffi_yajl/ffi/parser.rb index 7c1dbbc..11682dc 100644 --- a/lib/ffi_yajl/ffi/parser.rb +++ b/lib/ffi_yajl/ffi/parser.rb @@ -51,7 +51,7 @@ module FFI_Yajl s = stringval.slice(0,stringlen) s.force_encoding('UTF-8') if defined? Encoding # XXX: I can't think of a better way to do this right now. need to call to_f if and only if its a float. - v = ( s =~ /\./ ) ? s.to_f : s.to_i + v = ( s =~ /[\.eE]/ ) ? s.to_f : s.to_i set_value(v) 1 end diff --git a/spec/ffi_yajl/parser_spec.rb b/spec/ffi_yajl/parser_spec.rb index 4f6186e..c3424ef 100644 --- a/spec/ffi_yajl/parser_spec.rb +++ b/spec/ffi_yajl/parser_spec.rb @@ -9,7 +9,6 @@ describe "FFI_Yajl::Parser" do let(:json) { '{"key": 23456789012E666}' } it "should return infinity" do - skip "handle infinity properly" infinity = (1.0/0) expect(parser).to eq({"key" => infinity}) end |