Class: MJML::Parser
- Inherits:
-
Object
- Object
- MJML::Parser
- Defined in:
- lib/mjml/parser.rb
Defined Under Namespace
Classes: ExecutableNotFound, InvalidTemplate
Instance Method Summary collapse
- #call(template) ⇒ Object
- #call!(template) ⇒ Object
-
#initialize ⇒ Parser
constructor
A new instance of Parser.
Constructor Details
#initialize ⇒ Parser
Returns a new instance of Parser.
8 9 10 |
# File 'lib/mjml/parser.rb', line 8 def initialize raise ExecutableNotFound if MJML.executable_version.nil? end |
Instance Method Details
#call(template) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/mjml/parser.rb', line 12 def call(template) call!(template) rescue InvalidTemplate puts "Parser: Template doesn't exist" rescue StandardError => e puts "Parser: ERROR: #{e}" end |
#call!(template) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/mjml/parser.rb', line 20 def call!((template)) @input_file = template + '.mjml' @output_file = template + '.html' exec! end |