Class: Kaal::Config::FileLoader::EnvValue
- Inherits:
-
Object
- Object
- Kaal::Config::FileLoader::EnvValue
- Defined in:
- lib/kaal/config/file_loader.rb
Overview
Normalizes a single environment variable value into the requested config type.
Instance Method Summary collapse
- #coerce(key:, env_name:) ⇒ Object
-
#initialize(value) ⇒ EnvValue
constructor
A new instance of EnvValue.
Constructor Details
#initialize(value) ⇒ EnvValue
Returns a new instance of EnvValue.
16 17 18 |
# File 'lib/kaal/config/file_loader.rb', line 16 def initialize(value) @value = value.to_s.strip end |
Instance Method Details
#coerce(key:, env_name:) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/kaal/config/file_loader.rb', line 20 def coerce(key:, env_name:) case key when :tick_interval, :window_lookback, :window_lookahead, :lease_ttl, :recovery_window, :recovery_startup_jitter coerce_integer(env_name) when :enable_log_dispatch_registry, :enable_dispatch_recovery coerce_boolean(env_name) when :scheduler_conflict_policy, :scheduler_missing_file_policy @value.to_sym when :delayed_job_allowed_class_prefixes @value.split(',').map(&:strip).reject(&:empty?) else @value end end |