Module: TraceViz::Formatters::Helpers::SourceHelper

Included in:
TraceDataFormatter
Defined in:
lib/trace_viz/formatters/helpers/source_helper.rb

Instance Method Summary collapse

Instance Method Details

#source_location_representation(trace_data) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/trace_viz/formatters/helpers/source_helper.rb', line 9

def source_location_representation(trace_data)
  return unless config.source_location[:show]

  truncated_path = Utils::Format::ValueTruncator.truncate(
    trace_data.path,
    length: config.source_location[:truncate_length],
    direction: :start,
  )

  "at #{truncated_path}:#{trace_data.line_number}"
end