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
- VERSION_REGEX =
/^\d\.\d\.\d/i
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.
12 13 14 |
# File 'lib/mjml/parser.rb', line 12 def initialize raise ExecutableNotFound if mjml_version.nil? end |
Instance Method Details
#call(template) ⇒ Object
16 17 18 19 20 |
# File 'lib/mjml/parser.rb', line 16 def call(template) exec!(template) rescue InvalidTemplate nil end |
#call!(template) ⇒ Object
22 23 24 |
# File 'lib/mjml/parser.rb', line 22 def call!(template) exec!(template) end |