Module: AUOM::Inspection

Included in:
Unit
Defined in:
lib/auom/inspection.rb

Overview

Inspection module for auom units

Constant Summary collapse

INSPECT_FORMAT =
'<%s @scalar=%s%s>'.freeze
SCALAR_FORMAT =
'~%0.4f'.freeze
UNIT_FORMAT =
' %s/%s'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.prettify_unit_part(base) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return prettified units

Parameters:

  • base (Array)

Returns:

  • (String)


27
28
29
# File 'lib/auom/inspection.rb', line 27

def self.prettify_unit_part(base)
  counts(base).map { |unit, length| length > 1 ? "#{unit}^#{length}" : unit }.join('*')
end

Instance Method Details

#inspectString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return inspectable representation

Returns:

  • (String)


15
16
17
# File 'lib/auom/inspection.rb', line 15

def inspect
  format(INSPECT_FORMAT, self.class, pretty_scalar, pretty_unit)
end