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>'
SCALAR_FORMAT =
'~%0.4f'
UNIT_FORMAT =
' %s/%s'

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)


28
29
30
31
32
# File 'lib/auom/inspection.rb', line 28

def self.prettify_unit_part(base)
  counts(base).map do |unit, length|
    length > 1 ? "#{unit}^#{length}" : unit
  end.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)


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

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