Project

General

Profile

Bug #18038

Updated by maciej.mensfeld (Maciej Mensfeld) over 3 years ago

Given code as followed: 

 ``` ruby 
 var = 1 

 v1 = <<~CMD 
   something 
   #{"/#{var}"} 
 CMD 

 v2 = <<~CMD 
   something 
   #{other = "/#{var}"} 
 CMD 

 v3 = <<~CMD 
   something 
   #{("/#{var}")} 
 CMD 

 p v1 
 p v2 
 p v3 

 p v1 == v2 
 p v2 == v3 
 ``` 

 result of running this: 

 ```ruby 
 "something\n/\n" 
 "something\n/1\n" 
 "something\n/\n" 
 false 
 false 
 ``` 

 I would expect all both heredocs to return the same value for all the cases. It seems the `other` variable assignment should be irrelevant but only with it the value "1" is present. 

Back