Class: BootstrapEmail::Compiler
- Inherits:
-
Object
- Object
- BootstrapEmail::Compiler
- Defined in:
- lib/bootstrap-email/compiler.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
-
#doc ⇒ Object
Returns the value of attribute doc.
-
#premailer ⇒ Object
Returns the value of attribute premailer.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(input, type: :string, options: {}) ⇒ Compiler
constructor
A new instance of Compiler.
- #perform_html_compile ⇒ Object (also: #perform_full_compile)
- #perform_multipart_compile ⇒ Object
- #perform_text_compile ⇒ Object
Constructor Details
#initialize(input, type: :string, options: {}) ⇒ Compiler
Returns a new instance of Compiler.
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bootstrap-email/compiler.rb', line 7 def initialize(input, type: :string, options: {}) self.config = BootstrapEmail::Config.new() self.type = type case type when :string html = input when :file html = File.read(input) end html = add_layout(html) build_premailer_doc(html) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
5 6 7 |
# File 'lib/bootstrap-email/compiler.rb', line 5 def config @config end |
#doc ⇒ Object
Returns the value of attribute doc.
5 6 7 |
# File 'lib/bootstrap-email/compiler.rb', line 5 def doc @doc end |
#premailer ⇒ Object
Returns the value of attribute premailer.
5 6 7 |
# File 'lib/bootstrap-email/compiler.rb', line 5 def premailer @premailer end |
#type ⇒ Object
Returns the value of attribute type.
5 6 7 |
# File 'lib/bootstrap-email/compiler.rb', line 5 def type @type end |
Instance Method Details
#perform_html_compile ⇒ Object Also known as: perform_full_compile
31 32 33 34 35 36 37 38 |
# File 'lib/bootstrap-email/compiler.rb', line 31 def perform_html_compile @perform_html_compile ||= begin compile_html inline_css configure_html finalize_document end end |
#perform_multipart_compile ⇒ Object
20 21 22 23 24 25 |
# File 'lib/bootstrap-email/compiler.rb', line 20 def perform_multipart_compile @perform_multipart_compile ||= { text: perform_text_compile, html: perform_html_compile } end |
#perform_text_compile ⇒ Object
27 28 29 |
# File 'lib/bootstrap-email/compiler.rb', line 27 def perform_text_compile @perform_text_compile ||= plain_text end |