Class: Mjml::MrmlParser
- Inherits:
-
Object
- Object
- Mjml::MrmlParser
- Defined in:
- lib/mjml/mrml_parser.rb
Instance Attribute Summary collapse
-
#input ⇒ Object
readonly
Returns the value of attribute input.
-
#template_path ⇒ Object
readonly
Returns the value of attribute template_path.
Instance Method Summary collapse
-
#initialize(template_path, input) ⇒ MrmlParser
constructor
Create new parser.
-
#render ⇒ String
Render mjml template.
Constructor Details
#initialize(template_path, input) ⇒ MrmlParser
Create new parser
11 12 13 14 15 |
# File 'lib/mjml/mrml_parser.rb', line 11 def initialize(template_path, input) @template_path = template_path @input = input @with_cache = Cache.new(template_path) end |
Instance Attribute Details
#input ⇒ Object (readonly)
Returns the value of attribute input.
5 6 7 |
# File 'lib/mjml/mrml_parser.rb', line 5 def input @input end |
#template_path ⇒ Object (readonly)
Returns the value of attribute template_path.
5 6 7 |
# File 'lib/mjml/mrml_parser.rb', line 5 def template_path @template_path end |
Instance Method Details
#render ⇒ String
Render mjml template
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mjml/mrml_parser.rb', line 20 def render @with_cache.cache do MRML.to_html(input) rescue NameError Mjml.logger.fatal('MRML is not installed. Please add `gem "mrml"` to your Gemfile.') raise rescue StandardError raise if Mjml.raise_render_exception '' end end |