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:, response: :email) ⇒ Subprocess
constructor
Payload-agnostic transport: the caller builds and serializes the payload.
- #render ⇒ Object
Constructor Details
#initialize(payload:, label:, response: :email) ⇒ Subprocess
Payload-agnostic transport: the caller builds and serializes the payload. ‘label` identifies the render in error messages (component name or document type). `response` selects how the renderer’s reply is interpreted: ‘:email` builds a RenderedEmail (render/compose), `:document` returns the parsed document (parse).
15 16 17 18 19 |
# File 'lib/react_email_rails/render_modes/subprocess.rb', line 15 def initialize(payload:, label:, response: :email) @payload = payload @label = label @response = response 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
21 22 23 |
# File 'lib/react_email_rails/render_modes/subprocess.rb', line 21 def render run end |