def to_s(target_units = nil)
      out = @output[target_units]
      return out if out
      separator = RubyUnits.configuration.separator
      case target_units
      when :ft
        inches = convert_to('in').scalar.to_int
        out    = "#{(inches / 12).truncate}\'#{(inches % 12).round}\""
      when :lbs
        ounces = convert_to('oz').scalar.to_int
        out    = "#{(ounces / 16).truncate}#{separator}lbs, #{(ounces % 16).round}#{separator}oz"
      when :stone
        pounds = convert_to('lbs').scalar.to_int
        out = "#{(pounds / 14).truncate}#{separator}stone, #{(pounds % 14).round}#{separator}lb"
      when String
        out = case target_units.strip
              when /\A\s*\Z/ # whitespace only
                ''
              when /(%[\-+\.\w#]+)\s*(.+)*/ # format string like '%0.2f in'
                begin
                  if Regexp.last_match(2) # unit specified, need to convert
                    convert_to(Regexp.last_match(2)).to_s(Regexp.last_match(1))
                  else
                    "#{Regexp.last_match(1) % @scalar}#{separator}#{Regexp.last_match(2) || units}".strip
                  end
                rescue # parse it like a strftime format string
                  (DateTime.new(0) + self).strftime(target_units)
                end
              when /(\S+)/ # unit only 'mm' or '1/mm'
                convert_to(Regexp.last_match(1)).to_s
              else
                raise 'unhandled case'
              end
      else
        out = case @scalar
              when Complex
                "#{@scalar}#{separator}#{units}"
              when Rational
                "#{@scalar == @scalar.to_i ? @scalar.to_i : @scalar}#{separator}#{units}"
              else
                "#{'%g' % @scalar}#{separator}#{units}"
              end.strip
      end
      @output[target_units] = out
      out
    end
def to_s(target_units = nil)
      out = @output[target_units]
      return out if out
      separator = RubyUnits.configuration.separator
      case target_units
      when :ft
        inches = convert_to('in').scalar.to_int
        out    = "#{(inches / 12).truncate}\'#{(inches % 12).round}\""
      when :lbs
        ounces = convert_to('oz').scalar.to_int
        out    = "#{(ounces / 16).truncate}#{separator}lbs, #{(ounces % 16).round}#{separator}oz"
      when :stone
        pounds = convert_to('lbs').scalar.to_int
        out = "#{(pounds / 14).truncate}#{separator}stone, #{(pounds % 14).round}#{separator}lb"
      when String
        out = case target_units.strip
              when /\A\s*\Z/ # whitespace only
                ''
              when /(%[\-+\.\w#]+)\s*(.+)*/ # format string like '%0.2f in'
                begin
                  if Regexp.last_match(2) # unit specified, need to convert
                    convert_to(Regexp.last_match(2)).to_s(Regexp.last_match(1))
                  else
                    "#{Regexp.last_match(1) % @scalar}#{separator}#{Regexp.last_match(2) || units}".strip
                  end
                rescue # parse it like a strftime format string
                  (DateTime.new(0) + self).strftime(target_units)
                end
              when /(\S+)/ # unit only 'mm' or '1/mm'
                convert_to(Regexp.last_match(1)).to_s
              else
                raise 'unhandled case'
              end
      else
        out = case @scalar
              when Complex
                "#{@scalar}#{separator}#{units}"
              when Rational
                "#{@scalar == @scalar.to_i ? @scalar.to_i : @scalar}#{separator}#{units}"
              else
                "#{'%g' % @scalar}#{separator}#{units}"
              end.strip
      end
      @output[target_units] = out
      out
    end
Generate human readable output.
 If the name of a unit is passed, the unit will first be converted to the target unit before output.
 some named conversions are available

 @example
  unit.to_s(:ft) - outputs in feet and inches (e.g., 6'4")
  unit.to_s(:lbs) - outputs in pounds and ounces (e.g, 8 lbs, 8 oz)

 You can also pass a standard format string (i.e., '%0.2f')
 or a strftime format string.

 output is cached so subsequent calls for the same format will be fast

 @note Rational scalars that are equal to an integer will be represented as integers (i.e, 6/1 => 6, 4/2 => 2, etc..)
 @param [Symbol] target_units
 @return [String]