Module: CheckerJobs::Notifiers::FormatterHelpers

Included in:
BugsnagDefaultFormatter, EmailDefaultFormatter, Logger
Defined in:
lib/checker_jobs/notifiers/formatter_helpers.rb

Overview

Needs a @check instance variable and provides the methods:

  • #repository_url

  • #human_check_name

  • #format_entry (a generic one)

Constant Summary collapse

GITHUB_URL_FORMAT =
"https://github.com/%<repository>s/blob/master/%<path>s#L%<line>i".freeze

Instance Method Summary collapse

Instance Method Details

#format_entry(entry) ⇒ Object



8
9
10
# File 'lib/checker_jobs/notifiers/formatter_helpers.rb', line 8

def format_entry(entry)
  entry.respond_to?(:id) ? entry.id : entry.to_s
end

#human_check_nameObject



12
13
14
# File 'lib/checker_jobs/notifiers/formatter_helpers.rb', line 12

def human_check_name
  @check.name.tr("_", " ").capitalize
end

#repository_urlObject



16
17
18
19
20
21
22
# File 'lib/checker_jobs/notifiers/formatter_helpers.rb', line 16

def repository_url
  if repository_configuration.is_a?(String)
    repository_configuration
  elsif repository_configuration.key?(:github)
    github_url
  end
end