Class: DripDrop::HTTPServerHandlerResponse

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/dripdrop/handlers/http_server.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseHandler

#handle_error, #on_error, #print_exception

Constructor Details

#initialize(em_response) ⇒ HTTPServerHandlerResponse

Returns a new instance of HTTPServerHandlerResponse.



6
7
8
# File 'lib/dripdrop/handlers/http_server.rb', line 6

def initialize(em_response)
  @em_response   = em_response
end

Instance Attribute Details

#em_responseObject (readonly)

Returns the value of attribute em_response.



5
6
7
# File 'lib/dripdrop/handlers/http_server.rb', line 5

def em_response
  @em_response
end

#message_classObject (readonly)

Returns the value of attribute message_class.



5
6
7
# File 'lib/dripdrop/handlers/http_server.rb', line 5

def message_class
  @message_class
end

Instance Method Details

#send_message(message) ⇒ Object



10
11
12
13
14
15
# File 'lib/dripdrop/handlers/http_server.rb', line 10

def send_message(message)
  message = dd_messagify(message)
  @em_response.status = 200
  @em_response.content      = message.json_encoded
  @em_response.send_response
end