Class: Aldous::Respondable::Renderable
- Inherits:
-
Base
- Object
- Base
- Aldous::Respondable::Renderable
show all
- Defined in:
- lib/aldous/respondable/renderable.rb
Defined Under Namespace
Classes: RenderAction
Instance Attribute Summary
Attributes inherited from Base
#view_context, #view_data
Instance Method Summary
collapse
Methods inherited from Base
#build_view, #initialize, #status
Instance Method Details
#action(controller) ⇒ Object
7
8
9
|
# File 'lib/aldous/respondable/renderable.rb', line 7
def action(controller)
RenderAction.new(template, status, controller, view_data)
end
|
#default_status ⇒ Object
11
12
13
|
# File 'lib/aldous/respondable/renderable.rb', line 11
def default_status
:ok
end
|
#default_template_locals ⇒ Object
15
16
17
|
# File 'lib/aldous/respondable/renderable.rb', line 15
def default_template_locals
{}
end
|
#template(extra_locals = {}) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/aldous/respondable/renderable.rb', line 23
def template( = {})
template_locals = template_data[:locals] || {}
locals = default_template_locals.merge(template_locals)
locals = locals.merge( || {})
template_hash = template_data.merge(locals: locals)
template_hash
end
|
#template_data ⇒ Object
19
20
21
|
# File 'lib/aldous/respondable/renderable.rb', line 19
def template_data
{}
end
|