Class: CheckZilla::Notifier::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/checkzilla/notifier/email.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ Email

Returns a new instance of Email.



9
10
11
12
# File 'lib/checkzilla/notifier/email.rb', line 9

def initialize &block
  instance_eval(&block) if block_given?
  self
end

Instance Attribute Details

#pony_settingsObject

Returns the value of attribute pony_settings.



7
8
9
# File 'lib/checkzilla/notifier/email.rb', line 7

def pony_settings
  @pony_settings
end

Instance Method Details

#perform!(checkers) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/checkzilla/notifier/email.rb', line 14

def perform! checkers
  body = []
  checkers.each do |checker|
    checker_name = checker.class.name.split("::").last
    title = "#{checker_name} Report"
    body << "#{title}\n#{"="*title.size}"

    checker.results.each do |name, versions|
      local_version = versions[0]
      newer_version = versions[1]
      body << "#{name} from #{local_version} to #{newer_version}"
    end
    body << ["\n\n"]
  end
  binding.pry
  Pony.mail(@pony_settings.merge(:body => body.join("\n")))
end