class Asciidoctor::Reader

def peek_lines num = nil, direct = false

if there are no more lines in this Reader.
Returns A String Array of the next multiple lines of source data, or an empty Array

direct - A Boolean indicating whether processing should be disabled when reading lines (default: false).
num - The positive Integer number of lines to peek or nil to peek all lines (default: nil).

the lines again.
be processed and marked as such so that subsequent reads will not need to process
restores the lines to the stack before returning them. This allows the lines to
This method delegates to Reader#read_line to process and collect the line, then

already marked as processed, but does not consume them.
Public: Peek at the next multiple lines of source data. Processes the lines if not
def peek_lines num = nil, direct = false
  old_look_ahead = @look_ahead
  result = []
  (num || MAX_INT).times do
    if (line = direct ? shift : read_line)
      result << line
    else
      @lineno -= 1 if direct
      break
    end
  end
  unless result.empty?
    unshift_all result
    @look_ahead = old_look_ahead if direct
  end
  result
end