Class: Integrity::Notifier::Email

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Email.



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

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

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



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

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



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

def to
  @to
end

Class Method Details

.to_hamlObject



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

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

Instance Method Details

#deliver!Object



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

def deliver!
  email.deliver!
end

#emailObject



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

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

#subjectObject



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

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