Class: Lotus::RenderingPolicy Private

Inherits:
Object
  • Object
show all
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

Since:

  • 0.1.0

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.

Since:

  • 0.1.0

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.

Since:

  • 0.1.0

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.

Since:

  • 0.1.0

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.

Since:

  • 0.1.0

'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.

Since:

  • 0.1.0

(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.

Since:

  • 0.1.0

[:all, :html].freeze

Instance Method Summary collapse

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.

Since:

  • 0.1.0



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.

Since:

  • 0.1.0



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