Module: ActionView::Context
- Includes:
- CompiledTemplates
- Included in:
- Base, Helpers::InstanceTag, TestCase::Behavior
- Defined in:
- lib/action_view/context.rb
Overview
Action View Context
Action View contexts are supplied to Action Controller to render template. The default Action View context is ActionView::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 collapse
-
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
-
#view_flow ⇒ Object
Returns the value of attribute view_flow.
Instance Method Summary collapse
-
#_layout_for(name = nil) ⇒ Object
Encapsulates the interaction with the view flow so it returns the correct buffer on yield.
-
#_prepare_context ⇒ Object
Prepares the context by setting the appropriate instance variables.
Instance Attribute Details
#output_buffer ⇒ Object
Returns the value of attribute output_buffer.
17 18 19 |
# File 'lib/action_view/context.rb', line 17 def output_buffer @output_buffer end |
#view_flow ⇒ Object
Returns the value of attribute view_flow.
17 18 19 |
# File 'lib/action_view/context.rb', line 17 def view_flow @view_flow end |
Instance Method Details
#_layout_for(name = nil) ⇒ Object
Encapsulates the interaction with the view flow so it returns the correct buffer on yield. This is usually overwriten by helpers to add more behavior. :api: plugin
31 32 33 34 |
# File 'lib/action_view/context.rb', line 31 def _layout_for(name=nil) name ||= :layout view_flow.get(name).html_safe end |
#_prepare_context ⇒ Object
Prepares the context by setting the appropriate instance variables. :api: plugin
21 22 23 24 25 |
# File 'lib/action_view/context.rb', line 21 def _prepare_context @view_flow = OutputFlow.new @output_buffer = nil @virtual_path = nil end |