Class: DripDrop::HTTPDeferrableBody
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- DripDrop::HTTPDeferrableBody
- Includes:
- EventMachine::Deferrable
- Defined in:
- lib/dripdrop/handlers/http.rb
Instance Method Summary collapse
Instance Method Details
#call(body) ⇒ Object
8 9 10 11 12 |
# File 'lib/dripdrop/handlers/http.rb', line 8 def call(body) body.each do |chunk| @body_callback.call(chunk) end end |
#each(&blk) ⇒ Object
14 15 16 |
# File 'lib/dripdrop/handlers/http.rb', line 14 def each(&blk) @body_callback = blk end |
#send_message(raw_msg) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/dripdrop/handlers/http.rb', line 18 def (raw_msg) msg = dd_messagify(raw_msg) if msg.class == DripDrop::Message json = msg.encode_json self.call([json]) self.succeed else raise "Message Type '#{msg.class}' not supported" end end |