Module: ActionView::Context
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | actionview/lib/action_view/context.rb |
Overview
Action View contexts are supplied to Action Controller to render a template. The default Action View context is Base
.
In order to work with ::ActionController
, a Context
must just include this module. The initialization of the variables used by the context (@output_buffer, @view_flow, and @virtual_path) is responsibility of the object that includes this module (although you can call _prepare_context defined below).
Instance Attribute Summary
- #output_buffer rw
- #view_flow rw
Instance Method Summary
-
#_layout_for(name = nil)
Encapsulates the interaction with the view flow so it returns the correct buffer on
yield
. -
#_prepare_context
Prepares the context by setting the appropriate instance variables.
Instance Attribute Details
#output_buffer (rw)
[ GitHub ]# File 'actionview/lib/action_view/context.rb', line 19
attr_accessor :output_buffer, :view_flow
#view_flow (rw)
[ GitHub ]# File 'actionview/lib/action_view/context.rb', line 19
attr_accessor :output_buffer, :view_flow
Instance Method Details
#_layout_for(name = nil)
Encapsulates the interaction with the view flow so it returns the correct buffer on yield
. This is usually overwritten by helpers to add more behavior.
# File 'actionview/lib/action_view/context.rb', line 31
def _layout_for(name = nil) name ||= :layout view_flow.get(name).html_safe end
#_prepare_context
Prepares the context by setting the appropriate instance variables.
# File 'actionview/lib/action_view/context.rb', line 22
def _prepare_context @view_flow = OutputFlow.new @output_buffer = nil @virtual_path = nil end