We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
%W
1 parent 9269069 commit 2856aa6Copy full SHA for 2856aa6
doc/syntax/literals.rdoc
@@ -547,6 +547,13 @@ with <tt>%w</tt> (non-interpolable) or <tt>%W</tt> (interpolable):
547
# (not nested array).
548
%w[foo[bar baz]qux] # => ["foo[bar", "baz]qux"]
549
550
+The interpolated string is treated as a single word even if it contains
551
+whitespace.
552
+
553
+ s = "bar baz"
554
+ %W[foo #{s} zot] #=> ["foo", "bar baz", "zot"]
555
+ %W[foo #{"bar baz zot"} qux] # => ["foo", "bar baz zot", "qux"]
556
557
The following characters are considered as white spaces to separate words:
558
559
* space, ASCII 20h (SPC)
0 commit comments