more :: prefix elimination
[rainbows.git] / lib / rainbows / rev / deferred_response.rb
blob146f50534c21a149712e1fba5e14ec4b7eed8944
1 # -*- encoding: binary -*-
2 # :enddoc:
4 # this is class is specific to Rev for writing large static files
5 # or proxying IO-derived objects
6 class Rainbows::Rev::DeferredResponse < Rev::IO
7   def initialize(io, client, body)
8     super(io)
9     @client, @body = client, body
10   end
12   def on_read(data)
13     @client.write(data)
14   end
16   def on_close
17     @client.next! if @client.attached? # attached? is false if write fails
18     @body.respond_to?(:close) and @body.close
19   end
20 end