aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/renderer.rb
blob: e6c64d2749ff429bf2e9b9ab5613444bc3553026 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module ActionView
  module Renderer
    # TODO: Local assigns should not be tied to template instance
    attr_accessor :locals

    # TODO: These readers should be private
    attr_reader :filename, :source, :handler, :method_key, :method

    def render
      prepare!
      @handler.render(self)
    end

    private
      def prepare!
        unless @prepared
          @view.send(:evaluate_assigns)
          @view.current_render_extension = @extension

          if @handler.compilable?
            @handler.compile_template(self) # compile the given template, if necessary
            @method = @view.method_names[method_key] # Set the method name for this template and run it
          end

          @prepared = true
        end
      end
  end
end