class GitHubPages::HealthCheck::Checkable

Constants

HASH_METHODS

Array of symbolized methods to be included in the output hash

Public Instance Methods

[]()
Alias for: to_hash
check!() click to toggle source
# File lib/github-pages-health-check/checkable.rb, line 9
def check!
  raise "Not implemented"
end
Also aliased as: valid!
pretty_print()
Alias for: to_s_pretty
reason() click to toggle source

Returns the reason the check failed, if any

# File lib/github-pages-health-check/checkable.rb, line 23
def reason
  check!
  nil
rescue GitHubPages::HealthCheck::Error => e
  e
end
to_h()
Alias for: to_hash
to_hash() click to toggle 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
Also aliased as: [], to_h
to_json(state = nil) click to toggle source
# File lib/github-pages-health-check/checkable.rb, line 42
def to_json(state = nil)
  require "json"
  to_hash.to_json(state)
end
to_s() click to toggle source
# File lib/github-pages-health-check/checkable.rb, line 47
def to_s
  printer.simple_string
end
to_s_pretty() click to toggle source
# File lib/github-pages-health-check/checkable.rb, line 51
def to_s_pretty
  printer.pretty_print
end
Also aliased as: pretty_print
valid!()
Alias for: check!
valid?() click to toggle source

Runs all checks, returns true if valid, otherwise false

# File lib/github-pages-health-check/checkable.rb, line 15
def valid?
  check!
  true
rescue GitHubPages::HealthCheck::Error
  false
end

Private Instance Methods

printer() click to toggle source
# File lib/github-pages-health-check/checkable.rb, line 58
def printer
  @printer ||= GitHubPages::HealthCheck::Printer.new(self)
end