Class: Pixelpress::WeasyPrintRenderer
- Inherits:
-
Object
- Object
- Pixelpress::WeasyPrintRenderer
show all
- Defined in:
- lib/pixelpress/renderers/weasyprint_renderer.rb
Defined Under Namespace
Classes: WeasyPrintExecutionError, WeasyPrintInstallationError
Instance Method Summary
collapse
Instance Method Details
#render(input) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/pixelpress/renderers/weasyprint_renderer.rb', line 5
def render(input)
output = Tempfile.new
success = system(executable_path, "--encoding", "utf-8", input.path, output.path)
unless success
raise WeasyPrintExecutionError.new("WeasyPrint execution failed with exit code #{$?.exitstatus}")
end
return output
end
|
#version ⇒ Object
17
18
19
|
# File 'lib/pixelpress/renderers/weasyprint_renderer.rb', line 17
def version
`#{executable_path} --version`.chomp.scan(/(\d+\.\d+)/).flatten.first
end
|