From: asterite@... Date: 2018-03-08T14:57:54+00:00 Subject: [ruby-core:86051] [Ruby trunk Bug#14584] Squigly heredoc with interpolation that has a string literal withe spaces gets incorrect value Issue #14584 has been updated by asterite (Ary Borenszweig). Interestingly enough, it doesn't happen when you have: ~~~ text1 = <<~FOO one#{" two " * 1} FOO ~~~ So it seems Ruby does this only when the interpolation has a string literal, presumably to optimize that out and embed it into the resulting heredoc string. ---------------------------------------- Bug #14584: Squigly heredoc with interpolation that has a string literal withe spaces gets incorrect value https://bugs.ruby-lang.org/issues/14584#change-70916 * Author: asterite (Ary Borenszweig) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17] * Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN ---------------------------------------- Given this program: ~~~ text1 = <<~FOO one#{" two "} FOO text2 = <<~FOO one#{" two "} FOO p text1 p text2 ~~~ The output is: ~~~ "one two \n" "one two \n" ~~~ The two should be equal. I think the problem happens because squigly heredoc will remove the first two spaces from each line in the heredoc, but it seems to also be removing it from literals inside interpolation inside a heredoc. -- https://bugs.ruby-lang.org/ Unsubscribe: