Class: Postmortem::Delivery
- Inherits:
-
Object
- Object
- Postmortem::Delivery
- Defined in:
- lib/postmortem/delivery.rb
Overview
Abstraction of an email delivery. Capable of writing email HTML body to disk.
Instance Attribute Summary collapse
-
#index_path ⇒ Object
readonly
Returns the value of attribute index_path.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(mail) ⇒ Delivery
constructor
A new instance of Delivery.
- #record ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(mail) ⇒ Delivery
Returns a new instance of Delivery.
8 9 10 11 12 13 |
# File 'lib/postmortem/delivery.rb', line 8 def initialize(mail) @mail = mail @path = Postmortem.config.preview_directory.join('index.html') @index_path = Postmortem.config.preview_directory.join('postmortem_index.html') @identity_path = Postmortem.config.preview_directory.join('postmortem_identity.html') end |
Instance Attribute Details
#index_path ⇒ Object (readonly)
Returns the value of attribute index_path.
6 7 8 |
# File 'lib/postmortem/delivery.rb', line 6 def index_path @index_path end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/postmortem/delivery.rb', line 6 def path @path end |
Instance Method Details
#record ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/postmortem/delivery.rb', line 15 def record path.parent.mkpath content = Layout.new(@mail).content path.write(content) index_path.write(index.content) @identity_path.write(identity.content) end |
#uri ⇒ Object
23 24 25 |
# File 'lib/postmortem/delivery.rb', line 23 def uri "file://#{path}##{@mail.id}" end |