Class: Rack::DevInsight::Result
- Inherits:
-
Object
- Object
- Rack::DevInsight::Result
- Defined in:
- lib/rack/dev_insight/result.rb,
lib/rack/dev_insight/result/sql.rb,
lib/rack/dev_insight/result/apis.rb,
lib/rack/dev_insight/result/sql/queries.rb,
lib/rack/dev_insight/result/sql/errored_queries.rb,
lib/rack/dev_insight/result/sql/crud_aggregations.rb,
lib/rack/dev_insight/result/sql/normalized_aggregations.rb
Defined Under Namespace
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
Instance Method Summary collapse
- #add_api(method:, url:, request_headers:, request_body:, status:, response_headers:, response_body:, backtrace:, duration:) ⇒ Object
- #add_sql(dialect:, statement:, binds:, backtrace:, duration:) ⇒ Object
- #attributes ⇒ Object
-
#initialize(id) ⇒ Result
constructor
A new instance of Result.
- #set_request(status:, http_method:, path:, duration:) ⇒ Object
- #to_response_json ⇒ Object
Constructor Details
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
20 21 22 |
# File 'lib/rack/dev_insight/result.rb', line 20 def id @id end |
Class Method Details
Instance Method Details
#add_api(method:, url:, request_headers:, request_body:, status:, response_headers:, response_body:, backtrace:, duration:) ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/rack/dev_insight/result.rb', line 37 def add_api( method:, url:, request_headers:, request_body:, status:, response_headers:, response_body:, backtrace:, duration: ) @apis.add( method, url, request_headers, request_body, status, response_headers, response_body, backtrace, duration, ) end |
#add_sql(dialect:, statement:, binds:, backtrace:, duration:) ⇒ Object
33 34 35 |
# File 'lib/rack/dev_insight/result.rb', line 33 def add_sql(dialect:, statement:, binds:, backtrace:, duration:) @sql.add(dialect, statement, binds, backtrace, duration) end |
#attributes ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rack/dev_insight/result.rb', line 61 def attributes { id: @id, status: @request.status, method: @request.http_method, path: @request.path, duration: @request.duration, sql: @sql.attributes, apis: @apis.attributes, } end |
#set_request(status:, http_method:, path:, duration:) ⇒ Object
29 30 31 |
# File 'lib/rack/dev_insight/result.rb', line 29 def set_request(status:, http_method:, path:, duration:) @request = Request.new(status, http_method, path, duration) end |
#to_response_json ⇒ Object
73 74 75 |
# File 'lib/rack/dev_insight/result.rb', line 73 def to_response_json Camelizer.camelize_keys(attributes).to_json end |