From e30ca001efa861cc13259ca8287837174b24e679 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Valim?= Date: Sat, 16 Apr 2011 10:28:47 +0200 Subject: Yo dawg, I heard you like streaming. So I put a fiber, inside a block, inside a body, so you can stream. --- .../renderer/fibered_template_renderer.rb | 35 ---------------------- 1 file changed, 35 deletions(-) delete mode 100644 actionpack/lib/action_view/renderer/fibered_template_renderer.rb (limited to 'actionpack/lib/action_view/renderer/fibered_template_renderer.rb') diff --git a/actionpack/lib/action_view/renderer/fibered_template_renderer.rb b/actionpack/lib/action_view/renderer/fibered_template_renderer.rb deleted file mode 100644 index 45f48cab76..0000000000 --- a/actionpack/lib/action_view/renderer/fibered_template_renderer.rb +++ /dev/null @@ -1,35 +0,0 @@ -require 'action_view/renderer/template_renderer' -require 'fiber' - -module ActionView - class FiberedTemplateRenderer < TemplateRenderer #:nodoc: - # Renders the given template. An string representing the layout can be - # supplied as well. - def render_template(template, layout_name = nil, locals = {}) #:nodoc: - view, locals = @view, locals || {} - - final = nil - layout = layout_name && find_layout(layout_name, locals.keys) - yielder = lambda { |*name| view._layout_for(*name) } - - instrument(:template, :identifier => template.identifier, :layout => layout.try(:virtual_path)) do - @fiber = Fiber.new do - final = if layout - layout.render(view, locals, &yielder) - else - view._layout_for - end - end - - @view._view_flow = FiberedFlow.new(view._view_flow, @fiber) - @fiber.resume - - content = template.render(view, locals, &yielder) - view._view_flow.set(:layout, content) - @fiber.resume while @fiber.alive? - end - - final - end - end -end -- cgit v1.2.3