Class: MJML::Parser
- Inherits:
-
Object
- Object
- MJML::Parser
- Defined in:
- lib/mjml/parser.rb
Overview
Parser for MJML templates
Defined Under Namespace
Classes: ExecutableNotFound, InvalidTemplate
Constant Summary collapse
- ROOT_TAGS_REGEX =
%r{<mjml.*>.*<\/mjml>}im
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.
11 12 13 14 15 |
# File 'lib/mjml/parser.rb', line 11 def initialize MJML.logger.debug("Path: #{mjml_bin};" \ "Version: #{MJML.executable_version}") raise ExecutableNotFound if MJML.executable_version.nil? end |
Instance Method Details
#call(template) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/mjml/parser.rb', line 17 def call(template) @template = template exec! rescue InvalidTemplate nil end |
#call!(template) ⇒ Object
24 25 26 27 |
# File 'lib/mjml/parser.rb', line 24 def call!(template) @template = template exec! end |