Project

General

Profile

Bug #10024

Updated by nobu (Nobuyoshi Nakada) almost 10 years ago

The following code: 

 ```ruby 
 a = [] 
 a << ''.blank? ? 'blank' : 'not blank' 

 puts a 
 ``` 
 

 renders `[true]`. [true]. 

 I would expect it to render `['blank']` ['blank'] 

 If I wrap it in parenthesis it does work. 

 ```ruby 
 a = [] 
 a << ( ''.blank? ? 'blank' : 'not blank' ) 
 puts a # ['blank'] 
 ``` 
 

 it seems like the logic internally is perceiving this function as: 

 ```ruby 
 (a << ''.blank?) ? 'blank' : 'not blank' 
 ``` 
 

 Which seems illogical.

Back