Class: Documentum::Generator
- Inherits:
-
Object
- Object
- Documentum::Generator
- Defined in:
- lib/documentum/generator.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output_dir ⇒ Object
readonly
Returns the value of attribute output_dir.
-
#stylesheet_filenames ⇒ Object
readonly
Returns the value of attribute stylesheet_filenames.
-
#template_filename ⇒ Object
readonly
Returns the value of attribute template_filename.
Instance Method Summary collapse
- #generate_pdf(markdown_filename) ⇒ Object
-
#initialize(template_filename, output_dir, stylesheet_filenames: [], options: {}) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(template_filename, output_dir, stylesheet_filenames: [], options: {}) ⇒ Generator
Returns a new instance of Generator.
6 7 8 9 10 |
# File 'lib/documentum/generator.rb', line 6 def initialize(template_filename, output_dir, stylesheet_filenames: [], options: {}) @template_filename = template_filename @stylesheet_filenames = stylesheet_filenames @output_dir = output_dir end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
4 5 6 |
# File 'lib/documentum/generator.rb', line 4 def @options end |
#output_dir ⇒ Object (readonly)
Returns the value of attribute output_dir.
4 5 6 |
# File 'lib/documentum/generator.rb', line 4 def output_dir @output_dir end |
#stylesheet_filenames ⇒ Object (readonly)
Returns the value of attribute stylesheet_filenames.
4 5 6 |
# File 'lib/documentum/generator.rb', line 4 def stylesheet_filenames @stylesheet_filenames end |
#template_filename ⇒ Object (readonly)
Returns the value of attribute template_filename.
4 5 6 |
# File 'lib/documentum/generator.rb', line 4 def template_filename @template_filename end |
Instance Method Details
#generate_pdf(markdown_filename) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/documentum/generator.rb', line 12 def generate_pdf(markdown_filename) html = generate_html(markdown_filename) engine = PDFKit.new(html, page_size: "Letter") engine.stylesheets += @stylesheet_filenames engine.to_file(output_path(markdown_filename)) end |