lib/measured/unit_system_builder.rb in measured-2.4.0 vs lib/measured/unit_system_builder.rb in measured-2.5.0

- old
+ new

@@ -1,8 +1,9 @@ class Measured::UnitSystemBuilder def initialize @units = [] + @cache = nil end def unit(unit_name, aliases: [], value: nil) @units << build_unit(unit_name, aliases: aliases, value: value) nil @@ -11,11 +12,16 @@ def si_unit(unit_name, aliases: [], value: nil) @units += build_si_units(unit_name, aliases: aliases, value: value) nil end + def cache(cache_class, *args) + @cache = {class: cache_class, args: args} + nil + end + def build - Measured::UnitSystem.new(@units) + Measured::UnitSystem.new(@units, cache: @cache) end private SI_PREFIXES = [