Class: MRML::Template
- Inherits:
-
Object
- Object
- MRML::Template
- Defined in:
- lib/mrml/template.rb
Overview
Template object implemented in Rust that can parse MJML templates.
Instance Attribute Summary collapse
-
#preview ⇒ String
readonly
Gets mj-preview tag value.
-
#title ⇒ String
readonly
Gets mj-title tag value.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Template
A new instance of Template from Hash.
-
.from_json(json) ⇒ Template
A new instance of Template from JSON.
Instance Method Summary collapse
-
#initialize(mjml) ⇒ Template
constructor
A new instance of Template.
-
#to_hash ⇒ Hash
Hash representation of the template.
-
#to_html ⇒ String
HTML representation of the template.
-
#to_json ⇒ String
JSON representation of the template.
-
#to_mjml ⇒ String
MJML representation of the template.
Constructor Details
Instance Attribute Details
#preview ⇒ String (readonly)
Gets mj-preview tag value.
|
# File 'lib/mrml/template.rb', line 36
|
#title ⇒ String (readonly)
Gets mj-title tag value.
|
# File 'lib/mrml/template.rb', line 32
|
Class Method Details
.from_hash(hash) ⇒ Template
A new instance of Template from Hash.
21 22 23 |
# File 'lib/mrml/template.rb', line 21 def from_hash(hash) from_json(JSON.generate(hash)) end |
.from_json(json) ⇒ Template
A new instance of Template from JSON.
|
# File 'lib/mrml/template.rb', line 9
|
Instance Method Details
#to_hash ⇒ Hash
Hash representation of the template.
55 56 57 |
# File 'lib/mrml/template.rb', line 55 def to_hash JSON.parse(to_json) end |
#to_html ⇒ String
HTML representation of the template.
|
# File 'lib/mrml/template.rb', line 48
|
#to_json ⇒ String
JSON representation of the template.
|
# File 'lib/mrml/template.rb', line 44
|
#to_mjml ⇒ String
MJML representation of the template.
|
# File 'lib/mrml/template.rb', line 40
|