Class: Kaal::SchedulerTimeZoneResolver

Inherits:
Object
  • Object
show all
Defined in:
lib/kaal/config/scheduler_time_zone_resolver.rb

Overview

Resolves the configured scheduler time zone, preferring explicit config.

Constant Summary collapse

DEFAULT_TIME_ZONE =
'UTC'

Instance Method Summary collapse

Constructor Details

#initialize(configuration:) ⇒ SchedulerTimeZoneResolver

Returns a new instance of SchedulerTimeZoneResolver.



14
15
16
# File 'lib/kaal/config/scheduler_time_zone_resolver.rb', line 14

def initialize(configuration:)
  @configuration = configuration
end

Instance Method Details

#time_zone_identifierObject



18
19
20
21
22
23
24
25
# File 'lib/kaal/config/scheduler_time_zone_resolver.rb', line 18

def time_zone_identifier
  zone = begin
    Time.zone
  rescue NoMethodError
    nil
  end
  configured_time_zone || zone&.tzinfo&.identifier || DEFAULT_TIME_ZONE
end