summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-12 23:54:38 +0000
committerzzak <zzak@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-08-12 23:54:38 +0000
commit077fa24833e2eb397fa64b2d584bf8235d97df0b (patch)
treeec9dec2ad938bfb36ecb678aabc7eb7644b37598
parentda3d79d20311deb79c110c3fe07bbb184bc8f961 (diff)
* doc/syntax/literals.rdoc: [DOC] String literal concat by @cknadler
[Fixes GH-380] https://github.com/ruby/ruby/pull/380 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--doc/syntax/literals.rdoc12
2 files changed, 17 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index ed8a0df3e3..d426170b8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Aug 13 08:52:18 2013 Zachary Scott <e@zzak.io>
+
+ * doc/syntax/literals.rdoc: [DOC] String literal concat by @cknadler
+ [Fixes GH-380] https://github.com/ruby/ruby/pull/380
+
Mon Aug 12 23:07:21 2013 Masaya Tarui <tarui@ruby-lang.org>
* gc.c (gc_marks_test): inhibit gc for st's operation.
diff --git a/doc/syntax/literals.rdoc b/doc/syntax/literals.rdoc
index d521cafe31..e01b6875d4 100644
--- a/doc/syntax/literals.rdoc
+++ b/doc/syntax/literals.rdoc
@@ -111,6 +111,18 @@ like a single-quote string (no interpolation or character escaping) while
<tt>%Q</tt> behaves as a double-quote string. See Percent Strings below for
more discussion of the syntax of percent strings.
+Adjacent string literals are automatically concatenated by the interpreter:
+
+ "con" "cat" "en" "at" "ion" #=> "concatenation"
+ "This string contains "\
+ "no newlines." #=> "This string contains no newlines."
+
+Any combination of adjacent single-quote, double-quote, percent strings will
+be concatenated as long as a percent-string is not last.
+
+ %q{a} 'b' "c" #=> "abc"
+ "a" 'b' %q{c} #=> NameError: uninitialized constant q
+
=== Here Documents
If you are writing a large block of text you may use a "here document" or