Class: ReactEmailRails::RenderModes::Subprocess
- Inherits:
-
Object
- Object
- ReactEmailRails::RenderModes::Subprocess
- Defined in:
- lib/react_email_rails/render_modes/subprocess.rb
Direct Known Subclasses
Defined Under Namespace
Classes: CommandRunner
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(payload:, label:) ⇒ Subprocess
constructor
Payload-agnostic transport: the caller builds and serializes the payload.
- #render ⇒ Object
Constructor Details
#initialize(payload:, label:) ⇒ Subprocess
Payload-agnostic transport: the caller builds and serializes the payload. ‘label` identifies the render in error messages (component name or document type).
13 14 15 16 |
# File 'lib/react_email_rails/render_modes/subprocess.rb', line 13 def initialize(payload:, label:) @payload = payload @label = label end |
Class Method Details
.healthy?(command:, timeout:) ⇒ Boolean
3 4 5 6 7 8 |
# File 'lib/react_email_rails/render_modes/subprocess.rb', line 3 def healthy?(command:, timeout:) result = CommandRunner.capture([*command, "--health"], timeout:) result.status.success? && ReactEmailRails::RenderProtocol.compatible_response?(JSON.parse(result.stdout)) rescue StandardError false end |
Instance Method Details
#render ⇒ Object
18 19 20 |
# File 'lib/react_email_rails/render_modes/subprocess.rb', line 18 def render run end |