Class: Cocaine::Response
Instance Method Summary collapse
- #close ⇒ Object
- #error(errno, reason) ⇒ Object
-
#initialize(session, dispatcher) ⇒ Response
constructor
A new instance of Response.
- #write(data) ⇒ Object
Constructor Details
#initialize(session, dispatcher) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 |
# File 'lib/cocaine/server/response.rb', line 5 def initialize(session, dispatcher) @session = session @dispatcher = dispatcher @closed = false end |
Instance Method Details
#close ⇒ Object
21 22 23 24 25 |
# File 'lib/cocaine/server/response.rb', line 21 def close check_closed @closed = true @dispatcher.send_choke @session end |
#error(errno, reason) ⇒ Object
16 17 18 19 |
# File 'lib/cocaine/server/response.rb', line 16 def error(errno, reason) check_closed @dispatcher.send_error @session, errno, reason end |
#write(data) ⇒ Object
11 12 13 14 |
# File 'lib/cocaine/server/response.rb', line 11 def write(data) check_closed @dispatcher.send_chunk @session, data.to_msgpack end |