Class: AppMap::Rails::RequestHandler::HTTPServerResponse

Inherits:
Event::MethodReturnIgnoreValue show all
Defined in:
lib/appmap/rails/request_handler.rb

Constant Summary

Constants inherited from Event::MethodEvent

Event::MethodEvent::LIMIT

Instance Attribute Summary collapse

Attributes inherited from Event::MethodReturnIgnoreValue

#elapsed, #parent_id

Attributes inherited from Event::MethodEventStruct

#event, #id, #thread_id

Instance Method Summary collapse

Methods inherited from Event::MethodReturnIgnoreValue

build_from_invocation

Methods inherited from Event::MethodEvent

build_from_invocation, display_string

Constructor Details

#initialize(response, parent_id, elapsed) ⇒ HTTPServerResponse

Returns a new instance of HTTPServerResponse.



59
60
61
62
63
64
65
66
# File 'lib/appmap/rails/request_handler.rb', line 59

def initialize(response, parent_id, elapsed)
  super AppMap::Event.next_id_counter, :return, Thread.current.object_id

  self.status = response.status
  self.mime_type = response.headers['Content-Type']
  self.parent_id = parent_id
  self.elapsed = elapsed
end

Instance Attribute Details

#mime_typeObject

Returns the value of attribute mime_type.



57
58
59
# File 'lib/appmap/rails/request_handler.rb', line 57

def mime_type
  @mime_type
end

#statusObject

Returns the value of attribute status.



57
58
59
# File 'lib/appmap/rails/request_handler.rb', line 57

def status
  @status
end

Instance Method Details

#to_hObject



68
69
70
71
72
73
74
75
# File 'lib/appmap/rails/request_handler.rb', line 68

def to_h
  super.tap do |h|
    h[:http_server_response] = {
      status: status,
      mime_type: mime_type
    }.compact
  end
end