Sha256: e71a1306aac1976d771bf25c74caa9da625992b521a9d2c50b917dc4be56828b

Contents?: true

Size: 695 Bytes

Versions: 3

Compression:

Stored size: 695 Bytes

Contents

# Patching V8::Object because it is the entry point for conversions
# between Ruby and JavaScript types. We are using seconds since the
# epoch to represent dates. On 32 bit architectures, for recent dates
# this will be too large for Fixnum and become a Bignum. Ruby Racer
# worn't properly convert a Bignum to JavaScript, but it will work
# just fine for a Float. Because of this, we will convert all Bignums
# passed into a JavaScript context to a Float
module V8
  class Object
    alias :old_index_setter :'[]='
    
    def []=(key, value)
      if value.kind_of?(Bignum)
        old_index_setter(key, value.to_f)
      else
        old_index_setter(key, value)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
quality-measure-engine-0.1.2 lib/patches/v8.rb
quality-measure-engine-0.1.1 lib/patches/v8.rb
quality-measure-engine-0.1.0 lib/patches/v8.rb