13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/ruby_reduce/input_reader.rb', line 13
def read
current_chunks = []
in_error = false
File.new(@file_name).each do |line|
if line =~ /^Started/ && line =~ /newrelic/
elsif line =~ /^Started/
current_chunks << [line]
elsif line =~ /^Completed \d/
current_chunks.first << line
emit_chunk(@file_name, current_chunks.first.join(''))
current_chunks.delete_at 0
elsif line =~ /^Completed(\s)*in/
in_error = true
current_chunks.first << line
elsif in_error && line =~ /within rescues\/layout/
in_error = false
current_chunks.first << line
emit_chunk(@file_name, current_chunks.first.join(''))
current_chunks.delete_at 0
elsif line == '' || line == "\n"
else
current_chunks.first << line if current_chunks.first
end
end
@output
end
|