aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/inline_template.rb
blob: fb5e4408db48dc67a94f2ff2f2d173e40796728b (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
module ActionView #:nodoc:
  class InlineTemplate #:nodoc:
    include Renderable

    # Count the number of inline templates
    cattr_accessor :inline_template_count
    @@inline_template_count = 0

    def initialize(view, source, locals = {}, type = nil)
      @view = view

      @source = source
      @extension = type
      @locals = locals || {}

      @method_key = @source
      @handler = Template.handler_class_for_extension(@extension).new(@view)
    end

    private
      # FIXME: Modifying this shared variable may not thread safe
      def method_name_path_segment
        "inline_#{@@inline_template_count += 1}"
      end
  end
end