Method: Quantify::Unit::Base#has_same_identity_as?

Defined in:
lib/quantify/unit/base_unit.rb

#has_same_identity_as?(other) ⇒ Boolean Also known as: ==

Check if unit has the identity as another, i.e. the same label. This is used to determine if a unit with the same accessors already exists in the module variable @@units

Returns:

  • (Boolean)


382
383
384
# File 'lib/quantify/unit/base_unit.rb', line 382

def has_same_identity_as?(other)
  @label == other.label && !@label.nil?
end