Class: CheckerJobs::Notifiers::EmailDefaultFormatter

Inherits:
Object
  • Object
show all
Includes:
FormatterHelpers
Defined in:
lib/checker_jobs/notifiers/email_default_formatter.rb

Constant Summary

Constants included from FormatterHelpers

FormatterHelpers::GITHUB_URL_FORMAT

Instance Method Summary collapse

Methods included from FormatterHelpers

#human_check_name, #repository_url

Constructor Details

#initialize(check, count, entries) ⇒ EmailDefaultFormatter

Returns a new instance of EmailDefaultFormatter.



4
5
6
7
8
# File 'lib/checker_jobs/notifiers/email_default_formatter.rb', line 4

def initialize(check, count, entries)
  @check = check
  @count = count
  @entries = entries
end

Instance Method Details

#bodyObject



14
15
16
17
18
19
20
21
22
23
# File 'lib/checker_jobs/notifiers/email_default_formatter.rb', line 14

def body
  body = "<p>See more about this email on <a href='#{repository_url}'>Github</a>.</p>"
  if @entries
    body += "<p>Found %<class_name>s are: <ul>%<html_ids>s</ul></p>" % {
      class_name: @entries.first.class.name,
      html_ids: @entries.map { |entry| "<li>#{format_entry(entry)}</li>" }.join,
    }
  end
  body
end

#subjectObject



10
11
12
# File 'lib/checker_jobs/notifiers/email_default_formatter.rb', line 10

def subject
  "#{human_check_name} checker found #{@count} element(s)"
end