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#==



147
148
149
# File 'lib/jsi/util/private.rb', line 147

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



154
155
156
# File 'lib/jsi/util/private.rb', line 154

def hash
  jsi_fingerprint.hash
end