module Que::Scheduler::TimeZone

Constants

BOTH_CONFIG_AND_TIME_DOT_ZONE_SET
TIME_ZONE_CONFIG_IS_NOT_VALID
TIME_ZONE_COULD_NOT_BE_DETERMINED

Public Class Methods

time_zone() click to toggle source
# File lib/que/scheduler/time_zone.rb, line 38
def time_zone
  @time_zone ||=
    begin
      time_dot_zone = Time.zone
      if time_dot_zone.present?
        if Que::Scheduler.configuration.time_zone.present?
          raise BOTH_CONFIG_AND_TIME_DOT_ZONE_SET
        end

        time_dot_zone
      elsif Que::Scheduler.configuration.time_zone
        new_tz = ActiveSupport::TimeZone.new(Que::Scheduler.configuration.time_zone)
        raise TIME_ZONE_CONFIG_IS_NOT_VALID unless new_tz

        new_tz
      else
        raise TIME_ZONE_COULD_NOT_BE_DETERMINED
      end
    end
end