class GitHubPages::HealthCheck::Checkable
Constants
- HASH_METHODS
-
Array of symbolized methods to be included in the output hash
Public Instance Methods
Source
# File lib/github-pages-health-check/checkable.rb, line 9 def check! raise "Not implemented" end
Also aliased as: valid!
Source
# File lib/github-pages-health-check/checkable.rb, line 23 def reason check! nil rescue GitHubPages::HealthCheck::Error => e e end
Returns the reason the check failed, if any
Source
# File lib/github-pages-health-check/checkable.rb, line 30 def to_hash @to_hash ||= begin hash = {} self.class::HASH_METHODS.each do |method| hash[method] = public_send(method) end hash end end
Source
# File lib/github-pages-health-check/checkable.rb, line 42 def to_json(state = nil) require "json" to_hash.to_json(state) end
Source
# File lib/github-pages-health-check/checkable.rb, line 47 def to_s printer.simple_string end
Source
# File lib/github-pages-health-check/checkable.rb, line 51 def to_s_pretty printer.pretty_print end
Also aliased as: pretty_print
Source
# File lib/github-pages-health-check/checkable.rb, line 15 def valid? check! true rescue GitHubPages::HealthCheck::Error false end
Runs all checks, returns true if valid, otherwise false
Private Instance Methods
Source
# File lib/github-pages-health-check/checkable.rb, line 58 def printer @printer ||= GitHubPages::HealthCheck::Printer.new(self) end