Class: Lotus::RenderingPolicy Private
- Inherits:
-
Object
- Object
- Lotus::RenderingPolicy
- Defined in:
- lib/lotus/rendering_policy.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Rendering policy
Constant Summary collapse
- STATUS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
0
- HEADERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
1
- BODY =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
2
- LOTUS_ACTION =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
'lotus.action'.freeze
- SUCCESSFUL_STATUSES =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
(200..201).freeze
- RENDERABLE_FORMATS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
[:all, :html].freeze
Instance Method Summary collapse
-
#initialize(configuration) ⇒ RenderingPolicy
constructor
private
A new instance of RenderingPolicy.
- #render(env, response) ⇒ Object private
Constructor Details
#initialize(configuration) ⇒ RenderingPolicy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RenderingPolicy.
20 21 22 23 24 25 |
# File 'lib/lotus/rendering_policy.rb', line 20 def initialize(configuration) @controller_pattern = %r{#{ configuration.controller_pattern.gsub(/\%\{(controller|action)\}/) { "(?<#{ $1 }>(.*))" } }} @view_pattern = configuration.view_pattern @namespace = configuration.namespace @templates = configuration.templates end |
Instance Method Details
#render(env, response) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 30 31 32 |
# File 'lib/lotus/rendering_policy.rb', line 27 def render(env, response) body = _render(env, response) response[BODY] = Array(body) unless body.nil? || body.respond_to?(:each) response end |