class StatusCat::Status
Public Class Methods
all()
click to toggle source
Returns an array of instances of StatusCat::Checkers::Base
subclasses
# File lib/status_cat/status.rb, line 6 def self.all StatusCat::Config.instance.enabled.map { |name| factory(name) } end
check(which = :all)
click to toggle source
By default, returns all checkers If given a list of checker names, returns an array of those checkers If given a single checker name, just returns that checker
# File lib/status_cat/status.rb, line 13 def self.check(which = :all) return all if which == :all return factory(which) unless which.is_a?(Array) return which.map { |name| factory(name) } end
cron()
click to toggle source
Emails ::failed
list if it is not empty
# File lib/status_cat/status.rb, line 20 def self.cron checkers = failed StatusCat::StatusMailer.failure(checkers).deliver_now unless checkers.empty? end
factory(name)
click to toggle source
Constructs a checker instance given it's name
# File lib/status_cat/status.rb, line 26 def self.factory(name) ('StatusCat::Checkers::' + name.to_s.classify).constantize.new end
failed()
click to toggle source
Returns an array of failed instances of ::all
# File lib/status_cat/status.rb, line 31 def self.failed all.map { |checker| checker.status.nil? ? nil : checker }.compact end