Class: Integrity::Notifier::Email

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build, config = {}) ⇒ Email

Returns a new instance of Email.



14
15
16
17
18
19
# File 'lib/notifier/email.rb', line 14

def initialize(build, config={})
  @to     = config.delete("to")
  @from   = config.delete("from")
  super
  configure_mailer
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



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

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



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

def to
  @to
end

Class Method Details

.to_hamlObject



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

def self.to_haml
  File.read File.dirname(__FILE__) / "config.haml"
end

Instance Method Details

#deliver!Object



21
22
23
# File 'lib/notifier/email.rb', line 21

def deliver!
  email.deliver!
end

#emailObject



25
26
27
28
29
30
31
32
# File 'lib/notifier/email.rb', line 25

def email
  @email ||= Sinatra::Mailer::Email.new(
    :to => to,
    :from => from,
    :text => body,
    :subject => subject
  )
end

#subjectObject



34
35
36
# File 'lib/notifier/email.rb', line 34

def subject
  "[Integrity] #{build.project.name}: #{short_message}"
end