Module: BacktraceHelper

Defined in:
app/helpers/backtrace_helper.rb

Instance Method Summary collapse

Instance Method Details

#grouped_lines(lines) ⇒ Object

Group lines into sections of in-app files and external files (An implementation of Enumerable#chunk so we don't break 1.8.7 support.)


4
5
6
7
8
9
10
11
12
13
14
15
# File 'app/helpers/backtrace_helper.rb', line 4

def grouped_lines(lines)
  line_groups = []
  lines.each do |line|
    in_app = line.in_app?
    if line_groups.last && line_groups.last[0] == in_app
      line_groups.last[1] << line
    else
      line_groups << [in_app, [line]]
    end
  end
  line_groups
end