30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/rmtools/dev/trace_format.rb', line 30
def format_trace(a)
return [] if a.empty?
bt, steps, i = [], [], 0
m = a[0].parse:caller
while i < a.size
m2 = a[i+1] && a[i+1].parse(:caller)
if m and m.path !~ IgnoreFiles
step = a[i]
if step["\n"] bt << step
else
if m.block_level step = step.sub(/block (\(\d+ levels\) )?in/, '{'+m.block_level+'}')
end
if m and m.func and m2 and [m.path, m.line] == [m2.path, m2.line]
steps << " -> `#{'{'+m.block_level+'} ' if m.block_level}#{m.func}'"
elsif m and m.line != 0 and line = RMTools.highlighted_line(m.path, m.line)
bt << "#{step}#{steps.join}\n#{line}"
steps = []
else
bt << step
end
end
end
i += 1
m = m2
end
bt
end
|