mirror of
https://github.com/rubyjs/therubyracer
synced 2023-03-27 23:21:42 -04:00
proper fix for bigdecimal and bignum conversion.
This commit is contained in:
parent
2d94cbf943
commit
2978306272
4 changed files with 3 additions and 15 deletions
|
@ -12,7 +12,6 @@ require 'v8/conversion/code'
|
|||
require 'v8/conversion/class'
|
||||
require 'v8/conversion/object'
|
||||
require 'v8/conversion/time'
|
||||
require 'v8/conversion/bigdecimal'
|
||||
require 'v8/conversion/hash'
|
||||
require 'v8/conversion/array'
|
||||
require 'v8/conversion/proc'
|
||||
|
|
|
@ -12,13 +12,13 @@ class V8::Conversion
|
|||
end
|
||||
end
|
||||
|
||||
for type in [TrueClass, FalseClass, NilClass, Numeric] do
|
||||
for type in [TrueClass, FalseClass, NilClass, Float, Fixnum] do
|
||||
type.class_eval do
|
||||
include V8::Conversion::Primitive
|
||||
end
|
||||
end
|
||||
|
||||
for type in [Class, Object, Array, Hash, String, Symbol, Time, BigDecimal, Proc, Method] do
|
||||
for type in [Class, Object, Array, Hash, String, Symbol, Time, Proc, Method] do
|
||||
type.class_eval do
|
||||
include V8::Conversion.const_get(name)
|
||||
end
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
require 'bigdecimal'
|
||||
class V8::Conversion
|
||||
module BigDecimal
|
||||
def to_v8
|
||||
context = V8::Context.current
|
||||
constructor = context.to_v8(self.class)
|
||||
object = constructor.NewInstance([V8::C::External::New(self)])
|
||||
return object
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,5 +1,5 @@
|
|||
require 'spec_helper'
|
||||
|
||||
require 'bigdecimal'
|
||||
describe V8::Conversion do
|
||||
it "can embed BigDecimal values" do
|
||||
cxt = V8::Context.new
|
||||
|
|
Loading…
Reference in a new issue