class GitHubPages::HealthCheck::Error

Constants

DOCUMENTATION_BASE
DOCUMENTATION_PATH
LOCAL_ONLY

Attributes

domain[R]
repository[R]

Public Class Methods

inherited(base) click to toggle source
# File lib/github-pages-health-check/error.rb, line 18
def self.inherited(base)
  subclasses << base
end
new(repository: nil, domain: nil) click to toggle source
Calls superclass method
# File lib/github-pages-health-check/error.rb, line 12
def initialize(repository: nil, domain: nil)
  super
  @repository = repository
  @domain     = domain
end
subclasses() click to toggle source
# File lib/github-pages-health-check/error.rb, line 22
def self.subclasses
  @subclasses ||= []
end

Public Instance Methods

message() click to toggle source
# File lib/github-pages-health-check/error.rb, line 26
def message
  "Something's wrong with your GitHub Pages site."
end
message_formatted()
Alias for: message_with_url
message_with_url() click to toggle source

Error message, with get more info URL appended

# File lib/github-pages-health-check/error.rb, line 31
def message_with_url
  msg = message.gsub(/\s+/, " ").squeeze(" ").strip
  msg << "." unless msg.end_with?(".") # add trailing period if not there
  "#{msg} #{more_info}"
end
Also aliased as: message_formatted
to_s() click to toggle source
# File lib/github-pages-health-check/error.rb, line 38
def to_s
  "#{message_with_url} (#{name})".tr("\n", " ").squeeze(" ").strip
end

Private Instance Methods

documentation_url() click to toggle source
# File lib/github-pages-health-check/error.rb, line 60
def documentation_url
  URI.join(Error::DOCUMENTATION_BASE, self.class::DOCUMENTATION_PATH).to_s
end
more_info() click to toggle source
# File lib/github-pages-health-check/error.rb, line 56
def more_info
  "For more information, see #{documentation_url}."
end
name() click to toggle source
# File lib/github-pages-health-check/error.rb, line 44
def name
  self.class.name.split("::").last
end
username() click to toggle source
# File lib/github-pages-health-check/error.rb, line 48
def username
  if repository.nil?
    "[YOUR USERNAME]"
  else
    repository.owner
  end
end