aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-07 14:39:52 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-12-07 14:39:52 +0000
commit7f9827e4b3e76f215fa9fd36f24fd8e1fdef9866 (patch)
tree1a8a83e8ca857731116ed37273b53d6812afd011 /doc
parent586d91ce65404e06f26167ef98e6c5a949722920 (diff)
downloadruby-7f9827e4b3e76f215fa9fd36f24fd8e1fdef9866.tar.gz
parse.y: indented hereoc
* parse.y: add heredoc <<~ syntax. [Feature #9098] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52916 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'doc')
-rw-r--r--doc/syntax/literals.rdoc14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
index cbd18e9d4f..9631575320 100644
--- a/doc/syntax/literals.rdoc
+++ b/doc/syntax/literals.rdoc
@@ -196,6 +196,20 @@ Note that the while the closing identifier may be indented, the content is
always treated as if it is flush left. If you indent the content those spaces
will appear in the output.
+To have indented content as well as an indented closing identifier, you can use
+a "squiggly" heredoc, which uses a "~" instead of a "-" after <tt><<</tt>:
+
+ expected_result = <<~SQUIGGLY_HEREDOC
+ This would contain specially formatted text.
+
+ That might span many lines
+ SQUIGGLY_HEREDOC
+
+The indentation of the least-indented line will be removed from each line of
+the content. Note that empty lines and lines consisting solely of literal tabs
+and spaces will be ignored for the purposes of determining indentation, but
+escaped tabs and spaces are considered non-indentation characters.
+
A heredoc allows interpolation and escaped characters. You may disable
interpolation and escaping by surrounding the opening identifier with single
quotes: