about summary refs log tree commit homepage
path: root/lib/rainbows/rev/deferred_response.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rainbows/rev/deferred_response.rb')
-rw-r--r--lib/rainbows/rev/deferred_response.rb43
1 files changed, 19 insertions, 24 deletions
diff --git a/lib/rainbows/rev/deferred_response.rb b/lib/rainbows/rev/deferred_response.rb
index 243637d..f0172d6 100644
--- a/lib/rainbows/rev/deferred_response.rb
+++ b/lib/rainbows/rev/deferred_response.rb
@@ -1,28 +1,23 @@
 # -*- encoding: binary -*-
 # :enddoc:
-module Rainbows
-  module Rev
+#
+# this is class is specific to Rev for writing large static files
+# or proxying IO-derived objects
+class Rainbows::Rev::DeferredResponse < ::Rev::IO
+  def initialize(io, client, do_chunk, body)
+    super(io)
+    @client, @do_chunk, @body = client, do_chunk, body
+  end
 
-    # this is class is specific to Rev for writing large static files
-    # or proxying IO-derived objects
-    class DeferredResponse < ::Rev::IO
-      include Rainbows::Const
-      def initialize(io, client, do_chunk, body)
-        super(io)
-        @client, @do_chunk, @body = client, do_chunk, body
-      end
+  def on_read(data)
+    @do_chunk and @client.write("#{data.size.to_s(16)}\r\n")
+    @client.write(data)
+    @do_chunk and @client.write("\r\n")
+  end
 
-      def on_read(data)
-        @do_chunk and @client.write("#{data.size.to_s(16)}\r\n")
-        @client.write(data)
-        @do_chunk and @client.write("\r\n")
-      end
-
-      def on_close
-        @do_chunk and @client.write("0\r\n\r\n")
-        @client.next
-        @body.respond_to?(:close) and @body.close
-      end
-    end # class DeferredResponse
-  end # module Rev
-end # module Rainbows
+  def on_close
+    @do_chunk and @client.write("0\r\n\r\n")
+    @client.next
+    @body.respond_to?(:close) and @body.close
+  end
+end