Class: Observ::TraceTextFormatter
- Inherits:
-
Object
- Object
- Observ::TraceTextFormatter
- Defined in:
- app/services/observ/trace_text_formatter.rb
Constant Summary collapse
- SEPARATOR =
"=" * 80
- SUBSEPARATOR =
"-" * 80
- INDENT =
" "- MAX_CONTENT_LENGTH =
10_000
Instance Attribute Summary collapse
-
#trace ⇒ Object
readonly
Returns the value of attribute trace.
Instance Method Summary collapse
-
#format ⇒ Object
Main public method to format the trace as plain text.
-
#initialize(trace) ⇒ TraceTextFormatter
constructor
A new instance of TraceTextFormatter.
Constructor Details
#initialize(trace) ⇒ TraceTextFormatter
Returns a new instance of TraceTextFormatter.
12 13 14 |
# File 'app/services/observ/trace_text_formatter.rb', line 12 def initialize(trace) @trace = trace end |
Instance Attribute Details
#trace ⇒ Object (readonly)
Returns the value of attribute trace.
10 11 12 |
# File 'app/services/observ/trace_text_formatter.rb', line 10 def trace @trace end |
Instance Method Details
#format ⇒ Object
Main public method to format the trace as plain text
17 18 19 20 21 22 23 24 25 26 |
# File 'app/services/observ/trace_text_formatter.rb', line 17 def format parts = [] parts << format_trace_header parts << format_trace_details parts << format_trace_annotations if trace.annotations.any? parts << "" parts << format_observations_section parts << SEPARATOR parts.join("\n") end |