Class: Gitlab::Ci::Trace::SectionParser

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/ci/trace/section_parser.rb

Instance Method Summary collapse

Constructor Details

#initialize(lines) ⇒ SectionParser

Returns a new instance of SectionParser.


7
8
9
# File 'lib/gitlab/ci/trace/section_parser.rb', line 7

def initialize(lines)
  @lines = lines
end

Instance Method Details

#parse!Object


11
12
13
14
15
16
17
# File 'lib/gitlab/ci/trace/section_parser.rb', line 11

def parse!
  @markers = {}

  @lines.each do |line, pos|
    parse_line(line, pos)
  end
end

#sectionsObject


19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gitlab/ci/trace/section_parser.rb', line 19

def sections
  sanitize_markers.map do |name, markers|
    start_, end_ = markers

    {
      name: name,
      byte_start: start_[:marker],
      byte_end: end_[:marker],
      date_start: start_[:timestamp],
      date_end: end_[:timestamp]
    }
  end
end