Method: UnitMeasurements::UnitGroup#initialize

Defined in:
lib/unit_measurements/unit_group.rb

#initialize(primitive, units, cache_file) ⇒ UnitGroup

Initializes a new UnitGroup instance.

Parameters:

  • primitive (String|Symbol, optional)

    The name of the primitive unit.

  • units (Array<Unit>)

    An array of Unit instances.

  • cache_file (String)

    The name of the cache file.

Author:

Since:

  • 1.0.0



59
60
61
62
63
# File 'lib/unit_measurements/unit_group.rb', line 59

def initialize(primitive, units, cache_file)
  @units = units.map { |unit| unit.with(unit_group: self) }
  @primitive = unit_for!(primitive) if primitive
  @cache_file = cache_file
end