1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionview/lib/action_view/context.rb
Ryuta Kamizono 5349f23108 Remove :api: tag that has leaked on the doc directly [ci skip]
Currently `:api:` tag has leaked on the doc directly since RDoc doesn't
support `:api:` tag directive.

http://api.rubyonrails.org/v5.1/classes/AbstractController/Rendering.html

So `:api: private` doesn't work as expected. We are using `:nodoc:` for
the purpose.

Related #13989.
2017-09-30 18:42:46 +09:00

36 lines
1.2 KiB
Ruby

# frozen_string_literal: true
module ActionView
module CompiledTemplates #:nodoc:
# holds compiled template code
end
# = Action View Context
#
# Action View contexts are supplied to Action Controller to render a 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).
module Context
include CompiledTemplates
attr_accessor :output_buffer, :view_flow
# Prepares the context by setting the appropriate instance variables.
def _prepare_context
@view_flow = OutputFlow.new
@output_buffer = nil
@virtual_path = nil
end
# 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.
def _layout_for(name = nil)
name ||= :layout
view_flow.get(name).html_safe
end
end
end