Class: MaquinaStream::Renderer::ViewContext
- Inherits:
-
Object
- Object
- MaquinaStream::Renderer::ViewContext
- Defined in:
- lib/maquina_stream/renderer/view_context.rb
Overview
Renders engine partials without a request.
The renderer is a pure function, but components are ERB — so it builds its own view context from the engine's view paths rather than borrowing a controller's. "No request context" is the constraint; ActionView is not request context.
Defined Under Namespace
Classes: MissingActionView
Class Method Summary collapse
- .build ⇒ Object
-
.reset! ⇒ Object
Templates are looked up once per process, so a component change in development needs a reload — the same trade every engine partial makes.
Instance Method Summary collapse
Class Method Details
.build ⇒ Object
14 15 16 |
# File 'lib/maquina_stream/renderer/view_context.rb', line 14 def self.build @build ||= new end |
.reset! ⇒ Object
Templates are looked up once per process, so a component change in development needs a reload — the same trade every engine partial makes.
20 21 22 |
# File 'lib/maquina_stream/renderer/view_context.rb', line 20 def self.reset! @build = nil end |
Instance Method Details
#render(partial, locals = {}) ⇒ Object
24 25 26 |
# File 'lib/maquina_stream/renderer/view_context.rb', line 24 def render(partial, locals = {}) view.render(partial: partial, locals: locals) end |