Class: Ruact::RenderPipeline
- Inherits:
-
Object
- Object
- Ruact::RenderPipeline
- Defined in:
- lib/ruact/render_pipeline.rb
Overview
Internal — orchestrates the full server component render:
ERB source → (preprocessor) → evaluated HTML → (HtmlConverter) → ReactElement tree
→ (Flight::Renderer) → wire bytes
External code should use ‘Ruact::Controller#ruact_render` instead. `Ruact::RenderPipeline` (and the rest of `Ruact::Flight::*` / `Ruact::Internal::*`) are not part of the public API and may change between minor versions.
Single entry point: #render.
Constant Summary collapse
- VALID_MODES =
%i[string stream].freeze
Instance Method Summary collapse
-
#initialize(manifest, controller_path: nil, logger: nil) ⇒ RenderPipeline
constructor
A new instance of RenderPipeline.
-
#render(input, mode: :string) ⇒ String, Enumerator
Render a server component tree to Flight wire format.
Constructor Details
#initialize(manifest, controller_path: nil, logger: nil) ⇒ RenderPipeline
Returns a new instance of RenderPipeline.
18 19 20 21 22 |
# File 'lib/ruact/render_pipeline.rb', line 18 def initialize(manifest, controller_path: nil, logger: nil) @manifest = manifest @controller_path = controller_path @logger = logger end |
Instance Method Details
#render(input, mode: :string) ⇒ String, Enumerator
Render a server component tree to Flight wire format.
**Internal API.** External code should call ‘Ruact::Controller#ruact_render` instead. `Ruact::RenderPipeline` is not part of the public API and may change between minor versions without deprecation. Reach into it only when extending the gem itself.
64 65 66 67 68 |
# File 'lib/ruact/render_pipeline.rb', line 64 def render(input, mode: :string) validate_mode!(mode) enum = build_enum(input, streaming: mode == :stream) mode == :string ? enum.to_a.join : enum end |