Module: JSI::Util::Private::FingerprintHash Private

Included in:
AttrStruct, Immutable
Defined in:
lib/jsi/util/private.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defines equality methods and #hash (for Hash / Set), based on a method #jsi_fingerprint implemented by the includer. #jsi_fingerprint is to include the class and any properties of the instance which constitute its identity.

Defined Under Namespace

Modules: Immutable

Instance Method Summary collapse

Instance Method Details

#==(other) ⇒ Object Also known as: eql?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

overrides BasicObject#==



149
150
151
# File 'lib/jsi/util/private.rb', line 149

def ==(other)
  __id__ == other.__id__ || (other.is_a?(FingerprintHash) && jsi_fingerprint == other.jsi_fingerprint)
end

#hashObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

overrides Kernel#hash



156
157
158
# File 'lib/jsi/util/private.rb', line 156

def hash
  jsi_fingerprint.hash
end