diff options
Diffstat (limited to 'actionpack/lib/action_view/body_parts/future.rb')
-rw-r--r-- | actionpack/lib/action_view/body_parts/future.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/actionpack/lib/action_view/body_parts/future.rb b/actionpack/lib/action_view/body_parts/future.rb new file mode 100644 index 0000000000..a5291c6e8c --- /dev/null +++ b/actionpack/lib/action_view/body_parts/future.rb @@ -0,0 +1,26 @@ +module ActionView + module BodyParts + class Future + def initialize(&block) + @block = block + @parts = [] + end + + def to_s + finish + body + end + + protected + def work + @block.call(@parts) + end + + def body + str = '' + @parts.each { |part| str << part.to_s } + str + end + end + end +end |