diff options
author | Eric Wong <normalperson@yhbt.net> | 2010-07-19 10:10:03 +0000 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2010-07-19 17:04:33 -0700 |
commit | be17361f835840c7e356dbb75a6dfcafba6d0ebf (patch) | |
tree | 6fd428edde890c04466f7998af16e28686124aaf | |
parent | 13f310d935c3388f776f47536383e636b665b7b7 (diff) | |
download | rainbows-be17361f835840c7e356dbb75a6dfcafba6d0ebf.tar.gz |
Remove unnecessary include and also remove unnecessary nesting.
-rw-r--r-- | lib/rainbows/rev/deferred_response.rb | 43 |
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 |