Module: ReactEmailRails::RenderProtocol
- Extended by:
- RenderProtocol
- Included in:
- RenderProtocol
- Defined in:
- lib/react_email_rails/render_protocol.rb
Instance Method Summary collapse
- #compatible_metadata?(body) ⇒ Boolean
- #compatible_response?(body) ⇒ Boolean
-
#healthy_result?(result) ⇒ Boolean
Callers keep their own rescue to also cover failures obtaining the result.
- #mismatch_message(body) ⇒ Object
Instance Method Details
#compatible_metadata?(body) ⇒ Boolean
18 19 20 21 |
# File 'lib/react_email_rails/render_protocol.rb', line 18 def (body) body["protocolVersion"] == RENDER_PROTOCOL_VERSION && body["packageVersion"] == VERSION end |
#compatible_response?(body) ⇒ Boolean
14 15 16 |
# File 'lib/react_email_rails/render_protocol.rb', line 14 def compatible_response?(body) body["ok"] == true && (body) end |
#healthy_result?(result) ⇒ Boolean
Callers keep their own rescue to also cover failures obtaining the result.
10 11 12 |
# File 'lib/react_email_rails/render_protocol.rb', line 10 def healthy_result?(result) result.status.success? && compatible_response?(JSON.parse(result.stdout)) end |
#mismatch_message(body) ⇒ Object
23 24 25 26 |
# File 'lib/react_email_rails/render_protocol.rb', line 23 def (body) "renderer version mismatch: expected react-email-rails #{VERSION} protocol #{RENDER_PROTOCOL_VERSION}, " \ "got package #{body["packageVersion"].inspect} protocol #{body["protocolVersion"].inspect}" end |