diff options
author | José Valim <jose.valim@gmail.com> | 2011-05-01 14:50:42 +0200 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2011-05-01 14:50:42 +0200 |
commit | 8dbee3aba6920edcae20abf3af7f803e528f9ee0 (patch) | |
tree | be75f9a64d6183f26b3bf752c4ba17533fa00e26 /actionpack/lib/action_view | |
parent | 46611a995d91abf7bb2a64c62af13b6449c75b07 (diff) | |
download | rails-8dbee3aba6920edcae20abf3af7f803e528f9ee0.tar.gz rails-8dbee3aba6920edcae20abf3af7f803e528f9ee0.tar.bz2 rails-8dbee3aba6920edcae20abf3af7f803e528f9ee0.zip |
Streaming docs.
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/base.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_view/renderer/streaming_template_renderer.rb | 41 |
2 files changed, 1 insertions, 41 deletions
diff --git a/actionpack/lib/action_view/base.rb b/actionpack/lib/action_view/base.rb index 1890259ca0..baa2c5729f 100644 --- a/actionpack/lib/action_view/base.rb +++ b/actionpack/lib/action_view/base.rb @@ -139,7 +139,6 @@ module ActionView #:nodoc: # How to complete the streaming when an exception occurs. # This is our best guess: first try to close the attribute, then the tag. - # Currently this is private API and may be changed at *any* time. cattr_accessor :streaming_completion_on_exception @@streaming_completion_on_exception = %("><script type="text/javascript">window.location = "/500.html"</script></html>) diff --git a/actionpack/lib/action_view/renderer/streaming_template_renderer.rb b/actionpack/lib/action_view/renderer/streaming_template_renderer.rb index d987bc122a..1ccf5a8ddb 100644 --- a/actionpack/lib/action_view/renderer/streaming_template_renderer.rb +++ b/actionpack/lib/action_view/renderer/streaming_template_renderer.rb @@ -4,50 +4,11 @@ require 'fiber' if defined?(Fiber) module ActionView - # Consider the following layout: - # - # <%= yield :header %> - # 2 - # <%= yield %> - # 5 - # <%= yield :footer %> - # - # And template: - # - # <%= provide :header, "1" %> - # 3 - # 4 - # <%= provide :footer, "6" %> - # - # It will stream: - # - # "1\n", "2\n", "3\n4\n", "5\n", "6\n" - # - # Notice that once you <%= yield %>, it will render the whole template - # before streaming again. In the future, we can also support streaming - # from the template and not only the layout. - # - # Also, notice we use +provide+ instead of +content_for+, as +provide+ - # gives the control back to the layout as soon as it is called. - # With +content_for+, it would render all the template to find all - # +content_for+ calls. For instance, consider this layout: - # - # <%= yield :header %> - # - # With this template: - # - # <%= content_for :header, "1" %> - # <%= provide :header, "2" %> - # <%= provide :header, "3" %> - # - # It will return "12\n" because +content_for+ continues rendering the - # template but it is returns back to the layout as soon as it sees the - # first +provide+. - # # == TODO # # * Support streaming from child templates, partials and so on. # * Integrate exceptions with exceptron + # * Rack::Cache needs to support streaming bodies class StreamingTemplateRenderer < TemplateRenderer #:nodoc: # A valid Rack::Body (i.e. it responds to each). # It is initialized with a block that, when called, starts |