lib/sensu/utilities.rb
def in_time_windows?(conditions)
      in_window = false
      window_days = conditions[:days] || {}
      if window_days[:all]
        in_window = window_days[:all].any? do |condition|
          in_time_window?(condition)
        end
      end
      current_day = Time.now.strftime("%A").downcase.to_sym
      if !in_window && window_days[current_day]
        in_window = window_days[current_day].any? do |condition|
          in_time_window?(condition)
        end
      end
      in_window
    end
# Determine if time window conditions for one or more days of the
# week are met. If a day of the week is provided, it can provide
# one or more conditions, each with a `:begin` and `:end` time,
# eg. "11:30:00 PM", or `false` will be returned.
#
# @param conditions [Hash]
# @option conditions [String] :days of the week.
# @return [TrueClass, FalseClass]
Determine if time window conditions for one or more days of the
week are met. If a day of the week is provided, it can provide
one or more conditions, each with a `:begin` and `:end` time,
eg.
Determine if time window conditions for one or more days of the week are met . If a day of the week is provided it can provide one or more conditions each with a ` : begin ` and ` : end ` time eg .
def in_time_windows?(conditions)
      in_window = false
      window_days = conditions[:days] || {}
      if window_days[:all]
        in_window = window_days[:all].any? do |condition|
          in_time_window?(condition)
        end
      end
      current_day = Time.now.strftime("%A").downcase.to_sym
      if !in_window && window_days[current_day]
        in_window = window_days[current_day].any? do |condition|
          in_time_window?(condition)
        end
      end
      in_window
    end
def in_time_windows? ( conditions ) in_window = false window_days = conditions [ :days ] || { } if window_days [ :all ] in_window = window_days [ :all ] . any? do | condition | in_time_window? ( condition ) end end current_day = Time . now . strftime ( "%A" ) . downcase . to_sym if ! in_window && window_days [ current_day ] in_window = window_days [ current_day ] . any? do | condition | in_time_window? ( condition ) end end in_window end
Determine if time window conditions for one or more days of the
week are met.
Determine if time window conditions for one or more days of the week are met .
None
TrueClass, FalseClass
conditions
:days of the week.
: days of the week .
None