Method: UnitMeasurements::Cache#get

Defined in:
lib/unit_measurements/cache.rb

#get(source_unit, target_unit) ⇒ Numeric|NilClass

Retrieves the conversion factor between source and target units from the cache.

Parameters:

  • source_unit (String)

    The source unit name.

  • target_unit (String)

    The target unit name.

Returns:

  • (Numeric|NilClass)

    The conversion factor, or nil if not found in the cache.

Author:

Since:

  • 5.2.0



56
57
58
# File 'lib/unit_measurements/cache.rb', line 56

def get(source_unit, target_unit)
  cached_data.dig(source_unit, target_unit)
end