lib/good_job/configuration.rb in good_job-3.3.0 vs lib/good_job/configuration.rb in good_job-3.3.1
- old
+ new
@@ -25,11 +25,16 @@
# Default to always wait for jobs to finish for {Adapter#shutdown}
DEFAULT_SHUTDOWN_TIMEOUT = -1
# Default to not running cron
DEFAULT_ENABLE_CRON = false
+ def self.validate_execution_mode(execution_mode)
+ raise ArgumentError, "GoodJob execution mode must be one of #{EXECUTION_MODES.join(', ')}. It was '#{execution_mode}' which is not valid." unless execution_mode.in?(EXECUTION_MODES)
+ end
+
# The options that were explicitly set when initializing +Configuration+.
+ # It is safe to modify this hash in place; be sure to symbolize keys.
# @return [Hash]
attr_reader :options
# The environment from which to read GoodJob's environment variables. By
# default, this is the current process's environment, but it can be set
@@ -45,10 +50,10 @@
@options = options
@env = env
end
def validate!
- raise ArgumentError, "GoodJob execution mode must be one of #{EXECUTION_MODES.join(', ')}. It was '#{execution_mode}' which is not valid." unless execution_mode.in?(EXECUTION_MODES)
+ self.class.validate_execution_mode(execution_mode)
end
# Specifies how and where jobs should be executed. See {Adapter#initialize}
# for more details on possible values.
# @return [Symbol]