diff --git a/app/services/vot/legacy_component_values.rb b/app/services/vot/legacy_component_values.rb index d21b47ccc78..5ac5bab7836 100644 --- a/app/services/vot/legacy_component_values.rb +++ b/app/services/vot/legacy_component_values.rb @@ -76,11 +76,13 @@ module LegacyComponentValues requirements: [:aal2, :hspd12], ) + NAME_HASH = constants.map do |constant| + component_value = const_get(constant) + [component_value.name, component_value] + end.to_h + def self.by_name - @by_name ||= constants.map do |constant| - component_value = const_get(constant) - [component_value.name, component_value] - end.to_h + NAME_HASH end end end diff --git a/app/services/vot/supported_component_values.rb b/app/services/vot/supported_component_values.rb index ee8ba8e862e..8329e88b3bc 100644 --- a/app/services/vot/supported_component_values.rb +++ b/app/services/vot/supported_component_values.rb @@ -37,11 +37,13 @@ module SupportedComponentValues requirements: [:biometric_comparison], ) + NAME_HASH = constants.map do |constant| + component_value = const_get(constant) + [component_value.name, component_value] + end.to_h + def self.by_name - @by_name ||= constants.map do |constant| - component_value = const_get(constant) - [component_value.name, component_value] - end.to_h + NAME_HASH end end end