Sha256: 2ba63400b7e00a6d6c175db20e83b02788152287bc8887a30ce052671d14da0d

Contents?: true

Size: 1.08 KB

Versions: 37

Compression:

Stored size: 1.08 KB

Contents

# frozen_string_literal: true

module ActionView
  # = 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 Action Controller, 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
    attr_accessor :output_buffer, :view_flow

    # Prepares the context by setting the appropriate instance variables.
    def _prepare_context
      @view_flow     = OutputFlow.new
      @output_buffer = ActionView::OutputBuffer.new
      @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

Version data entries

37 entries across 37 versions & 5 rubygems

Version Path
actionview-8.0.0 lib/action_view/context.rb
actionview-7.2.2 lib/action_view/context.rb
actionview-7.1.5 lib/action_view/context.rb
actionview-8.0.0.rc2 lib/action_view/context.rb
actionview-7.2.1.2 lib/action_view/context.rb
actionview-7.1.4.2 lib/action_view/context.rb
actionview-8.0.0.rc1 lib/action_view/context.rb
actionview-7.2.1.1 lib/action_view/context.rb
actionview-7.1.4.1 lib/action_view/context.rb
actionview-8.0.0.beta1 lib/action_view/context.rb
omg-actionview-8.0.0.alpha9 lib/action_view/context.rb
omg-actionview-8.0.0.alpha8 lib/action_view/context.rb
omg-actionview-8.0.0.alpha7 lib/action_view/context.rb
omg-actionview-8.0.0.alpha4 lib/action_view/context.rb
omg-actionview-8.0.0.alpha3 lib/action_view/context.rb
omg-actionview-8.0.0.alpha2 lib/action_view/context.rb
omg-actionview-8.0.0.alpha1 lib/action_view/context.rb
actionview-7.1.4 lib/action_view/context.rb
actionview-7.2.1 lib/action_view/context.rb
actionview-7.2.0 lib/action_view/context.rb