module V8::Conversion::Identity

Public Instance Methods

equate(ruby_object, v8_object) click to toggle source
# File lib/v8/conversion/indentity.rb, line 18
def equate(ruby_object, v8_object)
  v8_idmap[v8_object.GetIdentityHash()] = ruby_object
  rb_idmap[ruby_object.object_id] = v8_object
end
rb_idmap() click to toggle source
# File lib/v8/conversion/indentity.rb, line 27
def rb_idmap
  @ruby_idmap ||= V8::Weak::WeakValueMap.new
end
to_ruby(v8_object) click to toggle source
Calls superclass method
# File lib/v8/conversion/indentity.rb, line 5
def to_ruby(v8_object)
  if v8_object.class <= V8::C::Object
    v8_idmap[v8_object.GetIdentityHash()] || super(v8_object)
  else
    super(v8_object)
  end
end
to_v8(ruby_object) click to toggle source
Calls superclass method
# File lib/v8/conversion/indentity.rb, line 13
def to_v8(ruby_object)
  return super(ruby_object) if ruby_object.is_a?(String) || ruby_object.is_a?(Primitive)
  rb_idmap[ruby_object.object_id] || super(ruby_object)
end
v8_idmap() click to toggle source
# File lib/v8/conversion/indentity.rb, line 23
def v8_idmap
  @v8_idmap ||= V8::Weak::WeakValueMap.new
end