def convert_to(other)
      return self if other.nil?
      return self if TrueClass === other
      return self if FalseClass === other
      if (Unit === other && other.temperature?) || (String === other && other =~ /temp[CFRK]/)
        raise ArgumentError, 'Receiver is not a temperature unit' unless degree?
        start_unit = units
        target_unit = begin
                        other.units
                      rescue
                        other
                      end
        @base_scalar ||= case @@unit_map[start_unit]
                         when '<tempC>'
                           @scalar + 273.15
                         when '<tempK>'
                           @scalar
                         when '<tempF>'
                           (@scalar + 459.67).to_r * Rational(5, 9)
                         when '<tempR>'
                           @scalar.to_r * Rational(5, 9)
                         end
        q = case @@unit_map[target_unit]
            when '<tempC>'
              @base_scalar - 273.15r
            when '<tempK>'
              @base_scalar
            when '<tempF>'
              @base_scalar.to_r * Rational(9, 5) - 459.67r
            when '<tempR>'
              @base_scalar.to_r * Rational(9, 5)
            end
        return RubyUnits::Unit.new("#{q} #{target_unit}")
      else
        case other
        when Unit
          return self if other.units == units
          target = other
        when String
          target = RubyUnits::Unit.new(other)
        else
          raise ArgumentError, 'Unknown target units'
        end
        raise ArgumentError, "Incompatible Units ('#{self}' not compatible with '#{other}')" unless self =~ target
        numerator1   = @numerator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |i| i.is_a?(Numeric) ? i : @@unit_values[i][:scalar] }.compact
        denominator1 = @denominator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |i| i.is_a?(Numeric) ? i : @@unit_values[i][:scalar] }.compact
        numerator2   = target.numerator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |x| x.is_a?(Numeric) ? x : @@unit_values[x][:scalar] }.compact
        denominator2 = target.denominator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |x| x.is_a?(Numeric) ? x : @@unit_values[x][:scalar] }.compact

        q = @scalar * ((numerator1 + denominator2).inject(1) { |acc, elem| acc * elem }) /
            ((numerator2 + denominator1).inject(1) { |acc, elem| acc * elem })
        return RubyUnits::Unit.new(scalar: q, numerator: target.numerator, denominator: target.denominator, signature: target.signature)
      end
    end
def convert_to(other)
      return self if other.nil?
      return self if TrueClass === other
      return self if FalseClass === other
      if (Unit === other && other.temperature?) || (String === other && other =~ /temp[CFRK]/)
        raise ArgumentError, 'Receiver is not a temperature unit' unless degree?
        start_unit = units
        target_unit = begin
                        other.units
                      rescue
                        other
                      end
        @base_scalar ||= case @@unit_map[start_unit]
                         when '<tempC>'
                           @scalar + 273.15
                         when '<tempK>'
                           @scalar
                         when '<tempF>'
                           (@scalar + 459.67).to_r * Rational(5, 9)
                         when '<tempR>'
                           @scalar.to_r * Rational(5, 9)
                         end
        q = case @@unit_map[target_unit]
            when '<tempC>'
              @base_scalar - 273.15r
            when '<tempK>'
              @base_scalar
            when '<tempF>'
              @base_scalar.to_r * Rational(9, 5) - 459.67r
            when '<tempR>'
              @base_scalar.to_r * Rational(9, 5)
            end
        return RubyUnits::Unit.new("#{q} #{target_unit}")
      else
        case other
        when Unit
          return self if other.units == units
          target = other
        when String
          target = RubyUnits::Unit.new(other)
        else
          raise ArgumentError, 'Unknown target units'
        end
        raise ArgumentError, "Incompatible Units ('#{self}' not compatible with '#{other}')" unless self =~ target
        numerator1   = @numerator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |i| i.is_a?(Numeric) ? i : @@unit_values[i][:scalar] }.compact
        denominator1 = @denominator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |i| i.is_a?(Numeric) ? i : @@unit_values[i][:scalar] }.compact
        numerator2   = target.numerator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |x| x.is_a?(Numeric) ? x : @@unit_values[x][:scalar] }.compact
        denominator2 = target.denominator.map { |x| @@prefix_values[x] ? @@prefix_values[x] : x }.map { |x| x.is_a?(Numeric) ? x : @@unit_values[x][:scalar] }.compact

        q = @scalar * ((numerator1 + denominator2).inject(1) { |acc, elem| acc * elem }) /
            ((numerator2 + denominator1).inject(1) { |acc, elem| acc * elem })
        return RubyUnits::Unit.new(scalar: q, numerator: target.numerator, denominator: target.denominator, signature: target.signature)
      end
    end
convert to a specified unit string or to the same units as another Unit

  unit.convert_to "kg"   will covert to kilograms
  unit1.convert_to unit2 converts to same units as unit2 object

 To convert a Unit object to match another Unit object, use:
  unit1 >>= unit2

 Special handling for temperature conversions is supported.  If the Unit object is converted
 from one temperature unit to another, the proper temperature offsets will be used.
 Supports Kelvin, Celsius, Fahrenheit, and Rankine scales.

 @note If temperature is part of a compound unit, the temperature will be treated as a differential
   and the units will be scaled appropriately.
 @param [Object] other
 @return [Unit]
 @raise [ArgumentError] when attempting to convert a degree to a temperature
 @raise [ArgumentError] when target unit is unknown
 @raise [ArgumentError] when target unit is incompatible