lib/quantify/quantity.rb
# Conversion where both units (including compound units) are of precisely
# equivalent dimensions, i.e. direct alternatives for one another. Where
# previous unit is a compound unit, new unit must be cancelled by all original
# base units
#
Conversion where both units (including compound units) are of precisely
equivalent dimensions, i.e. direct alternatives for one another. Where
previous unit is a compound unit, new unit must be cancelled by all original
base units
Conversion where both units ( including compound units ) are of precisely equivalent dimensions i . e . direct alternatives for one another . Where previous unit is a compound unit new unit must be cancelled by all original base units
def convert_to_equivalent_unit!(new_unit)
      old_unit = @unit
      self.multiply!(Unit.ratio new_unit, old_unit)
      old_base_units = old_unit.base_units.map { |base| base.unit } if old_unit.is_compound_unit?
      self.cancel_base_units!(*old_base_units || [old_unit])
    end
def convert_to_equivalent_unit! ( new_unit ) old_unit = @unit self . multiply! ( Unit . ratio new_unit , old_unit ) old_base_units = old_unit . base_units . map { | base | base . unit } if old_unit . is_compound_unit? self . cancel_base_units! ( * old_base_units || [ old_unit ] ) end
Conversion where both units (including compound units) are of precisely
equivalent dimensions, i.e.
Conversion where both units ( including compound units ) are of precisely equivalent dimensions i . e .
new_unit
<not_specific>