Class: Cucumber::Messages::Helpers::NdjsonToMessageEnumerator

Inherits:
Enumerator
  • Object
show all
Defined in:
lib/cucumber/messages/helpers/ndjson_to_message_enumerator.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ NdjsonToMessageEnumerator

Returns a new instance of NdjsonToMessageEnumerator.



9
10
11
12
13
14
15
16
17
18
# File 'lib/cucumber/messages/helpers/ndjson_to_message_enumerator.rb', line 9

def initialize(io)
  super() do |yielder|
    io.each_line do |line|
      next if line.strip.empty?

      message = extract_message(line)
      yielder.yield(message)
    end
  end
end