module CheckerJobs::DSL
DSL
to declare checker jobs. It provides predicates:
And configuration methods:
-
options
-
notify
-
interval
Public Instance Methods
add_check(klass, name, options, block)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 68 def add_check(klass, name, options, block) name = name.to_s raise CheckerJobs::DuplicateCheckerName, name if checks.key?(name) checks[name] = klass.new(self, name, options, block) end
checks()
click to toggle source
# File lib/checker_jobs/dsl.rb, line 64 def checks @checks ||= {} end
ensure_fewer(name, options = {}, &block)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 36 def ensure_fewer(name, options = {}, &block) add_check CheckerJobs::Checks::EnsureFewer, name, options, block end
ensure_more(name, options = {}, &block)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 32 def ensure_more(name, options = {}, &block) add_check CheckerJobs::Checks::EnsureMore, name, options, block end
ensure_no(name, options = {}, &block)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 28 def ensure_no(name, options = {}, &block) add_check CheckerJobs::Checks::EnsureNo, name, options, block end
interval(duration)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 24 def interval(duration) @time_between_checks = duration end
notifier()
click to toggle source
Private API
# File lib/checker_jobs/dsl.rb, line 44 def notifier raise CheckerJobs::MissingNotifier, self.class unless defined?(@notifier) @notifier end
notifier_options()
click to toggle source
# File lib/checker_jobs/dsl.rb, line 50 def notifier_options raise CheckerJobs::MissingNotifier, self.class unless defined?(@notifier) @notifier_options end
notify(notifier, notifier_options = {})
click to toggle source
# File lib/checker_jobs/dsl.rb, line 19 def notify(notifier, notifier_options = {}) @notifier = notifier @notifier_options = notifier_options end
option(key, default = nil)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 60 def option(key, default = nil) @options && @options[key] || default end
options(options_hash)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 15 def options(options_hash) @options = options_hash end
perform_check(check_name)
click to toggle source
# File lib/checker_jobs/dsl.rb, line 76 def perform_check(check_name) checks.fetch(check_name.to_s).perform end
time_between_checks()
click to toggle source
# File lib/checker_jobs/dsl.rb, line 56 def time_between_checks @time_between_checks || CheckerJobs.configuration.time_between_checks end