Class: Racket::ViewManager
- Inherits:
-
Object
- Object
- Racket::ViewManager
- Defined in:
- lib/racket/view_manager.rb
Overview
Handles rendering in Racket applications.
Class Method Summary collapse
-
.service(_options = {}) ⇒ Proc
Returns a service proc that can be used by the registry.
Instance Method Summary collapse
-
#initialize(locator, renderer) ⇒ ViewManager
constructor
A new instance of ViewManager.
-
#render(controller) ⇒ Hash
Renders a controller based on the request path and the variables set in the controller instance.
Constructor Details
#initialize(locator, renderer) ⇒ ViewManager
Returns a new instance of ViewManager.
30 31 32 33 |
# File 'lib/racket/view_manager.rb', line 30 def initialize(locator, renderer) @locator = locator @renderer = renderer end |
Class Method Details
.service(_options = {}) ⇒ Proc
Returns a service proc that can be used by the registry.
26 27 28 |
# File 'lib/racket/view_manager.rb', line 26 def self.service( = {}) ->(reg) { new(reg.template_locator, reg.template_renderer) } end |
Instance Method Details
#render(controller) ⇒ Hash
Renders a controller based on the request path and the variables set in the controller instance.
40 41 42 |
# File 'lib/racket/view_manager.rb', line 40 def render(controller) @renderer.render(controller, *get_view_and_layout(controller)) end |