lib/quantify/unit/base_unit.rb
# Determine if self is equivalent to another. Equivalency is based on
# representing the same physical quantity (i.e. dimensions) and the same
# factor and scaling values.
#
#  Unit.metre.is_equivalent_to? Unit.foot    #=> false
#
#  Unit.metre.is_equivalent_to? Unit.gram    #=> false
#
#  Unit.metre.is_equivalent_to? Unit.metre   #=> true
#
# The base_units attr of Compound units are not compared. Neither are the
# names or symbols. This is because we want to recognise cases where units
# derived from operations and defined as compound units (therefore having
# compounded names and symbols) are the same as known, named units. For
# example, if we build a unit for energy using only SI units, we want to
# recognise this as a joule, rather than a kg m^2 s^-2, e.g.
#
#   (Unit.kg*Unit.m*Unit.m/Unit.s/Unit.s).is_equivalent_to? Unit.joule
#
#                                      #=> true
#
Determine if self is equivalent to another. Equivalency is based on
representing the same physical quantity  and the same
factor and scaling values.







The base_units attr of Compound units are not compared. Neither are the
names or symbols. This is because we want to recognise cases where units
derived from operations and defined as compound units (therefore having
compounded names and symbols) are the same as known, named units. For
example, if we build a unit for energy using only SI units, we want to
recognise this as a joule, rather than a kg m^2 s^-2, e.g.



> true
Determine if self is equivalent to another . Equivalency is based on representing the same physical quantity and the same factor and scaling values . The base_units attr of Compound units are not compared . Neither are the names or symbols . This is because we want to recognise cases where units derived from operations and defined as compound units ( therefore having compounded names and symbols ) are the same as known named units . For example if we build a unit for energy using only SI units we want to recognise this as a joule rather than a kg m^2 s^ - 2 e . g . > true
def is_equivalent_to?(other)
        return false if other.nil?
        return false unless self.factor == other.factor
        return false unless self.scaling == other.scaling
        return false unless self.dimensions == other.dimensions
        true
      end
def is_equivalent_to? ( other ) return false if other . nil? return false unless self . factor == other . factor return false unless self . scaling == other . scaling return false unless self . dimensions == other . dimensions true end
Determine if self is equivalent to another.
Determine if self is equivalent to another .
other
<not_specific>