def each(delimiter, field_count, start_match)
      return enum_for(__method__, delimiter, field_count, start_match) unless block_given?

      chunked = each_field(delimiter).chunk(&chunk_matches(start_match))

      yield_fields = lambda do |(_, chunk)|
        chunk.each { |e| yield e }
        (field_count - chunk.size).times { yield "" }
      end

      # Skip junk that might appear before the first start-of-fields match
      begin
        n, chunk = chunked.next
        yield_fields.call([n, chunk]) unless n.zero?
      rescue StopIteration
        return
      end

      chunked.each(&yield_fields)
    end
def each(delimiter, field_count, start_match)
      return enum_for(__method__, delimiter, field_count, start_match) unless block_given?

      chunked = each_field(delimiter).chunk(&chunk_matches(start_match))

      yield_fields = lambda do |(_, chunk)|
        chunk.each { |e| yield e }
        (field_count - chunk.size).times { yield "" }
      end

      # Skip junk that might appear before the first start-of-fields match
      begin
        n, chunk = chunked.next
        yield_fields.call([n, chunk]) unless n.zero?
      rescue StopIteration
        return
      end

      chunked.each(&yield_fields)
    end
Yields fields extracted from a input stream
 @param [String, nil] delimiter   the field separator
 @param [Integer]     field_count the number of fields to extract
 @param [Regexp]      start_match a +Regexp+ that, when matched against the
   input stream, signifies the beginning of the next series of fields to
   yield
 @yieldparam [String] field each field extracted from the stream. If
   +start_match+ is matched with fewer than +field_count+ fields yielded
   since the last match, yields empty strings until +field_count+ is
   reached.