Where is Ruby's string literal juxtaposition feature officially documented? -
i realized if juxtapose sequence of ruby string literals (e.g. 'a' "b" 'c'
), it's equivalent concatenation of string literals. however, can't find language feature documented anywhere. i've searched using terms "juxtaposition" , "concatenation", found reference in couple of stackoverflow responses. can point me definitive reference?
update
this now officially documented in rdoc ships ruby.
changes propagate rubydoc next time build documentation.
the added documentation:
adjacent string literals automatically concatenated interpreter: "con" "cat" "en" "at" "ion" #=> "concatenation" "this string contains "\ "no newlines." #=> "this string contains no newlines." combination of adjacent single-quote, double-quote, percent strings concatenated long percent-string not last. %q{a} 'b' "c" #=> "abc" "a" 'b' %q{c} #=> nameerror: uninitialized constant q
original
right now, isn't anywhere in official ruby documentation, think should be. pointed out in comment, logical place docs go be: http://www.ruby-doc.org/core-2.0/doc/syntax/literals_rdoc.html#label-strings
i've opened pull request on ruby/ruby documentation added.
if pull request merged, automatically update http://www.ruby-doc.org. i'll update post if/when happens. ^_^
the other mentions of i've found online are:
- the ruby programming language, page 47 (mentioned in answer)
- ruby forum post circa 2008
- programming ruby
Comments
Post a Comment