2008-04-19 11:16:32 -04:00
|
|
|
module ActionView #:nodoc:
|
2008-07-03 14:06:00 -04:00
|
|
|
class InlineTemplate #:nodoc:
|
2008-07-05 13:05:50 -04:00
|
|
|
include Renderable
|
2008-07-03 14:06:00 -04:00
|
|
|
|
2008-07-05 17:27:43 -04:00
|
|
|
# Count the number of inline templates
|
|
|
|
cattr_accessor :inline_template_count
|
|
|
|
@@inline_template_count = 0
|
|
|
|
|
2008-04-19 11:16:32 -04:00
|
|
|
def initialize(view, source, locals = {}, type = nil)
|
|
|
|
@view = view
|
2008-06-15 22:22:27 -04:00
|
|
|
|
2008-04-19 11:16:32 -04:00
|
|
|
@source = source
|
|
|
|
@extension = type
|
|
|
|
@locals = locals || {}
|
2008-06-15 22:22:27 -04:00
|
|
|
|
2008-07-03 14:06:00 -04:00
|
|
|
@method_key = @source
|
2008-07-03 22:08:27 -04:00
|
|
|
@handler = Template.handler_class_for_extension(@extension).new(@view)
|
2008-04-19 11:16:32 -04:00
|
|
|
end
|
2008-07-05 17:27:43 -04:00
|
|
|
|
|
|
|
private
|
|
|
|
# FIXME: Modifying this shared variable may not thread safe
|
|
|
|
def method_name_path_segment
|
|
|
|
"inline_#{@@inline_template_count += 1}"
|
|
|
|
end
|
2008-04-19 11:16:32 -04:00
|
|
|
end
|
|
|
|
end
|