Sha256: 09ffe6f552cecb6e80ae0d8a8aaf5362eb6d7839238397740b8b7ab534dc53ba
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
module StatusCat class Status # Returns an array of instances of StatusCat::Checkers::Base subclasses def self.all StatusCat::Config.instance.enabled.map { |name| factory(name) } end # 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 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 # Emails ::failed list if it is not empty def self.cron checkers = failed StatusCat::StatusMailer.failure(checkers).deliver_now unless checkers.empty? end # Constructs a checker instance given it's name def self.factory(name) ('StatusCat::Checkers::' + name.to_s.classify).constantize.new end # Returns an array of failed instances of ::all def self.failed all.map { |checker| checker.status.nil? ? nil : checker }.compact end end end
Version data entries
5 entries across 5 versions & 1 rubygems