lib/asciidoctor/include_ext/include_processor.rb
def read_lines(filename, selector)
      if selector
        IO.foreach(filename).select.with_index(1, &selector)
      else
        open(filename, &:read)
      end
    end
def read_lines(filename, selector)
      if selector
        IO.foreach(filename).select.with_index(1, &selector)
      else
        open(filename, &:read)
      end
    end
Reads the specified file as individual lines, filters them using the
 *selector* (if provided) and returns those lines in an array.

 @param filename [String] path of the file to be read.
 @param selector [#to_proc, nil] predicate to filter lines that should be
   included in the output. It must accept two arguments: line and
   the line number. If `nil` is given, all lines are passed.
 @return [Array<String>] an array of read lines.