aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/notification.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mauve/notification.rb')
-rw-r--r--lib/mauve/notification.rb28
1 files changed, 27 insertions, 1 deletions
diff --git a/lib/mauve/notification.rb b/lib/mauve/notification.rb
index 899972b..6ff9541 100644
--- a/lib/mauve/notification.rb
+++ b/lib/mauve/notification.rb
@@ -157,6 +157,18 @@ module Mauve
(@test_time - @alert.raised_at) >= seconds
end
+ # Tests if the alert has raised for a certain time.
+ #
+ # @param [Integer] seconds Number of seconds
+ # @return [Boolean]
+ def raised_for(seconds)
+ @test_time = @time if @test_time.nil?
+ @alert &&
+ @alert.raised? &&
+ (@test_time - @alert.raised_at) >= seconds
+ end
+
+
# Checks to see if x is contained in y
#
# @param [Array] y Array to search for +x+
@@ -177,10 +189,17 @@ module Mauve
# @return [Boolean]
def working_hours?
@test_time = @time if @test_time.nil?
- @test_time.bank_holidays = Server.instance.bank_holidays
@test_time.working_hours?
end
+ #
+ # Return true if today is a bank holiday
+ #
+ def bank_holiday?
+ @test_time = @time if @test_time.nil?
+ @test_time.bank_holiday?
+ end
+
# Test to see if we're in the dead zone. See Time#dead_zone?
#
# @return [Boolean]
@@ -189,6 +208,13 @@ module Mauve
@test_time.dead_zone?
end
+ #
+ # Return true if we're in daytime_hours. See Time#daytime_hours?
+ #
+ def daytime_hours?
+ @test_time = @time if @test_time.nil?
+ @test_time.daytime_hours?
+ end
end
# A Notification is an instruction to notify a person, or a list of people,