lib/ultra_settings/configuration.rb in ultra_settings-2.4.0 vs lib/ultra_settings/configuration.rb in ultra_settings-2.4.1

- old
+ new

@@ -531,15 +531,18 @@ def __get_value__(name) field = self.class.send(:defined_fields)[name] return nil unless field - if field.static? && @ultra_settings_memoized_values.include?(name) + use_override = @ultra_settings_override_values[Thread.current.object_id]&.include?(name) + + if field.static? && !use_override && @ultra_settings_memoized_values.include?(name) return @ultra_settings_memoized_values[name] end - if @ultra_settings_override_values[Thread.current.object_id]&.include?(name) + value = nil + if use_override value = field.coerce(@ultra_settings_override_values[Thread.current.object_id][name]) else env = ENV if field.env_var settings = UltraSettings.__runtime_settings__ if field.runtime_setting yaml_config = __yaml_config__ if field.yaml_key @@ -549,10 +552,10 @@ if __use_default?(value, field.default_if) value = field.default end - if field.static? + if field.static? && !use_override @ultra_settings_mutex.synchronize do if @ultra_settings_memoized_values.include?(name) value = @ultra_settings_memoized_values[name] else @ultra_settings_memoized_values[name] = value