Class: WeasyRb::Executor
- Inherits:
-
Object
- Object
- WeasyRb::Executor
- Defined in:
- lib/weasy_rb/executor.rb
Overview
Executes WeasyPrint commands using Open3
Defined Under Namespace
Classes: Result
Instance Method Summary collapse
-
#execute(command, html_content) ⇒ Result
Execute WeasyPrint command with HTML input rubocop:disable Metrics/MethodLength.
Instance Method Details
#execute(command, html_content) ⇒ Result
Execute WeasyPrint command with HTML input rubocop:disable Metrics/MethodLength
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/weasy_rb/executor.rb', line 20 def execute(command, html_content) validate_weasyprint_availability stdout, stderr, status = capture_command_output(command, html_content) Result.new( success: status.success?, output: stdout, error: stderr, exit_status: status.exitstatus ) rescue Errno::ENOENT raise CommandError, "WeasyPrint is not installed or not available in PATH" rescue StandardError => e raise CommandError, "Failed to execute WeasyPrint: #{e.message}" end |