Class: Postmortem::Layout
- Inherits:
-
Object
- Object
- Postmortem::Layout
- Defined in:
- lib/postmortem/layout.rb
Overview
Wraps provided body in an enclosing layout for presentation purposes.
Instance Method Summary collapse
- #content ⇒ Object
- #css_dependencies ⇒ Object
- #favicon_b64 ⇒ Object
- #format_email_array(array) ⇒ Object
- #headers_template ⇒ Object
-
#initialize(mail) ⇒ Layout
constructor
A new instance of Layout.
- #javascript ⇒ Object
- #javascript_dependencies ⇒ Object
- #styles ⇒ Object
- #upload_url ⇒ Object
Constructor Details
#initialize(mail) ⇒ Layout
Returns a new instance of Layout.
6 7 8 |
# File 'lib/postmortem/layout.rb', line 6 def initialize(mail) @mail = mail end |
Instance Method Details
#content ⇒ Object
14 15 16 17 18 |
# File 'lib/postmortem/layout.rb', line 14 def content mail = @mail mail.html_body = with_inlined_images(mail.html_body) if defined?(Nokogiri) ERB.new(Postmortem.config.layout.read).result(binding) end |
#css_dependencies ⇒ Object
28 29 30 |
# File 'lib/postmortem/layout.rb', line 28 def css_dependencies default_layout_directory.join('dependencies.css').read end |
#favicon_b64 ⇒ Object
40 41 42 |
# File 'lib/postmortem/layout.rb', line 40 def favicon_b64 default_layout_directory.join('favicon.b64').read end |
#format_email_array(array) ⇒ Object
10 11 12 |
# File 'lib/postmortem/layout.rb', line 10 def format_email_array(array) array&.map { |email| %(<a href="mailto:#{email}">#{email}</a>) }&.join(', ') end |
#headers_template ⇒ Object
36 37 38 |
# File 'lib/postmortem/layout.rb', line 36 def headers_template default_layout_directory.join('headers_template.html').read end |
#javascript ⇒ Object
24 25 26 |
# File 'lib/postmortem/layout.rb', line 24 def javascript default_layout_directory.join('layout.js').read end |
#javascript_dependencies ⇒ Object
32 33 34 |
# File 'lib/postmortem/layout.rb', line 32 def javascript_dependencies default_layout_directory.join('dependencies.js').read end |
#styles ⇒ Object
20 21 22 |
# File 'lib/postmortem/layout.rb', line 20 def styles default_layout_directory.join('layout.css').read end |
#upload_url ⇒ Object
44 45 46 |
# File 'lib/postmortem/layout.rb', line 44 def upload_url ENV.fetch('POSTMORTEM_DELIVERY_URL', 'https://postmortem.delivery/emails') end |