Skip to content

Instantly share code, notes, and snippets.

@agrare
Last active May 17, 2021 15:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agrare/1bda71f35dc013dd87db985c3a8cf036 to your computer and use it in GitHub Desktop.
Save agrare/1bda71f35dc013dd87db985c3a8cf036 to your computer and use it in GitHub Desktop.
schedule_settings_for_ems_refresh = ExtManagementSystem.supported_subclasses.each.with_object({}) do |klass, hash|
next unless klass.ems_type
every = ::Settings.ems_refresh[klass.ems_type].try(:refresh_interval) || ::Settings.ems_refresh.refresh_interval
every = every.respond_to?(:to_i_with_method) ? every.to_i_with_method : every.to_i
hash[klass] = every unless every == 0
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment