Class: Sentiero::Reporter::ReportContext
- Inherits:
-
Object
- Object
- Sentiero::Reporter::ReportContext
- Defined in:
- lib/sentiero/reporter/report_context.rb
Overview
Splits a Context into the reserved keys that become top-level fields on an error report (session_id, window_id) and the remaining metadata that goes under the report's "context".
Constant Summary collapse
- RESERVED =
%w[session_id window_id].freeze
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Mutable so the caller can inject environment/release before scrubbing.
Instance Method Summary collapse
-
#initialize(context) ⇒ ReportContext
constructor
A new instance of ReportContext.
- #session_id ⇒ Object
- #window_id ⇒ Object
Constructor Details
#initialize(context) ⇒ ReportContext
Returns a new instance of ReportContext.
11 12 13 14 15 16 17 18 19 |
# File 'lib/sentiero/reporter/report_context.rb', line 11 def initialize(context) data = context.to_h @reserved = {} RESERVED.each do |key| value = data.delete(key) @reserved[key] = value unless value.nil? end @metadata = data end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Mutable so the caller can inject environment/release before scrubbing.
26 27 28 |
# File 'lib/sentiero/reporter/report_context.rb', line 26 def @metadata end |
Instance Method Details
#session_id ⇒ Object
21 |
# File 'lib/sentiero/reporter/report_context.rb', line 21 def session_id = @reserved["session_id"] |
#window_id ⇒ Object
23 |
# File 'lib/sentiero/reporter/report_context.rb', line 23 def window_id = @reserved["window_id"] |