Class: Md2Pdf::Template
- Inherits:
-
Struct
- Object
- Struct
- Md2Pdf::Template
- Defined in:
- lib/md2pdf/template.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#template_location ⇒ Object
Returns the value of attribute template_location.
Instance Method Summary collapse
- #create(shell) ⇒ Object
- #create_pdf_converter(shell, temp_filename_creator = TempFileCreator) ⇒ Object
- #exists? ⇒ Boolean
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
7 8 9 |
# File 'lib/md2pdf/template.rb', line 7 def name @name end |
#template_location ⇒ Object
Returns the value of attribute template_location
7 8 9 |
# File 'lib/md2pdf/template.rb', line 7 def template_location @template_location end |
Instance Method Details
#create(shell) ⇒ Object
12 13 14 15 16 |
# File 'lib/md2pdf/template.rb', line 12 def create(shell) raise TemplateExistsError.new("template #{name} already exists") if exists? FileUtils.mkdir_p(template_location.path_for(name)) shell.exec("pandoc -D latex > #{template_location.path_for(tex_template_path)}") end |
#create_pdf_converter(shell, temp_filename_creator = TempFileCreator) ⇒ Object
8 9 10 |
# File 'lib/md2pdf/template.rb', line 8 def create_pdf_converter(shell, temp_filename_creator = TempFileCreator) wrap_in_backgrounder PandocConverter.new(shell, pandoc_tex_template), shell, temp_filename_creator end |
#exists? ⇒ Boolean
18 19 20 |
# File 'lib/md2pdf/template.rb', line 18 def exists? template_location.contains?(tex_template_path) end |