Module: Ibex::Coverage::EventStream
- Defined in:
- lib/ibex/coverage/event_stream.rb,
sig/ibex/coverage/event_stream.rbs
Overview
Bounded reader for the public runtime-event JSON Lines protocol.
Defined Under Namespace
Modules: _CoverageEventInput
Constant Summary collapse
- MAX_LINE_BYTES =
1_048_576- MAX_NESTING =
32- ROOT_KEYS =
%w[data event ibex_runtime_event schema_version sequence].freeze
- EVENT_TYPES =
%w[start shift reduce error recover discard accept reject].freeze
Class Method Summary collapse
Class Method Details
.each_file(path) {|arg0, arg1| ... } ⇒ void
This method returns an undefined value.
25 26 27 |
# File 'lib/ibex/coverage/event_stream.rb', line 25 def each_file(path, &block) File.open(path, "rb") { |input| each_io(input, source: path, &block) } end |
.each_io(input, source:) {|arg0, arg1| ... } ⇒ void
This method returns an undefined value.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ibex/coverage/event_stream.rb', line 31 def each_io(input, source:, &block) line_number = 0 while (line = input.gets(MAX_LINE_BYTES + 1)) line_number += 1 reject_oversized_line(line, source, line_number) document = parse_line(line, source, line_number) validate_envelope(document, source, line_number) block.call(document, line_number) end raise_invalid(source, 1, "event stream is empty") if line_number.zero? end |