class Asciidoctor::Reader
def skip_comment_lines opts = {}
=> ["bar"]
@lines
=> ["// foo"]
comment_lines = skip_comment_lines
=> ["// foo", "bar"]
@lines
Examples
Public: Skip consecutive lines containing line comments and return them.
def skip_comment_lines opts = {} return [] if eof? comment_lines = [] include_blank_lines = opts[:include_blank_lines] while (next_line = peek_line) if include_blank_lines && next_line.empty? comment_lines << shift elsif (commentish = next_line.start_with?('//')) && (match = CommentBlockRx.match(next_line)) comment_lines << shift comment_lines.push(*(read_lines_until(:terminator => match[0], :read_last_line => true, :skip_processing => true))) elsif commentish && CommentLineRx =~ next_line comment_lines << shift else break end end comment_lines end