Class: RedAlert::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/red_alert/notification.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(subject, body) ⇒ Notification

Returns a new instance of Notification.



7
8
9
10
# File 'lib/red_alert/notification.rb', line 7

def initialize(subject, body)
  @subject = subject
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/red_alert/notification.rb', line 5

def body
  @body
end

#subjectObject (readonly)

Returns the value of attribute subject.



5
6
7
# File 'lib/red_alert/notification.rb', line 5

def subject
  @subject
end

Class Method Details

.build(subject_template, body_template, exception, data = {}) ⇒ Object



13
14
15
16
17
# File 'lib/red_alert/notification.rb', line 13

def build(subject_template, body_template, exception, data = {})
  subject = compile_subject subject_template, exception
  body = compile_body body_template, exception, data
  self.new subject, body
end