From 330b376133e00ae418bcf01e641e127df01fbc28 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 29 Apr 2019 00:24:26 +0900 Subject: parse.y: fix here-doc identifier with newline * parse.y (heredoc_identifier): quoted here-document identifier must end within the same line. the only corner case that here-document identifier can contain a newline is that the closing qoute is placed at the beginning of the next line, and has been warned since 2.4. ```ruby <<"EOS " # warning: here document identifier ends with a newline EOS ``` --- doc/syntax/literals.rdoc | 3 +++ 1 file changed, 3 insertions(+) (limited to 'doc') diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc index ecf7d62a2a..00bc4f89d6 100644 --- a/doc/syntax/literals.rdoc +++ b/doc/syntax/literals.rdoc @@ -255,6 +255,9 @@ behaves like Kernel#`: cat #{__FILE__} HEREDOC +When surrounding with quotes, any characters but that quote and newline +can be used as the identifier. + To call a method on a heredoc place it after the opening identifier: expected_result = <<-EXPECTED.chomp -- cgit v1.2.3