Class: MJML::Parser

Inherits:
Object
  • Object
show all
Defined in:
lib/mjml/parser.rb

Defined Under Namespace

Classes: ExecutableNotFound, InvalidTemplate

Instance Method Summary collapse

Constructor Details

#initializeParser

Returns a new instance of Parser.

Raises:



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