From: blainekasten@... Date: 2014-07-10T15:40:21+00:00 Subject: [ruby-core:63635] [ruby-trunk - Bug #10024] [Open] Array injection of ternary operators injects boolean rather than ternary result Issue #10024 has been reported by Blaine Kasten. ---------------------------------------- Bug #10024: Array injection of ternary operators injects boolean rather than ternary result https://bugs.ruby-lang.org/issues/10024 * Author: Blaine Kasten * Status: Open * Priority: Normal * Assignee: * Category: * Target version: * ruby -v: 2.1.2 * Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN ---------------------------------------- The following code: a = [] a << ''.blank? ? 'blank' : 'not blank' puts a renders [true]. I would expect it to render ['blank'] If I wrap it in parenthesis it does work. a = [] a << ( ''.blank? ? 'blank' : 'not blank' ) puts a # ['blank'] it seems like the logic internally is perceiving this function as: (a << ''.blank?) ? 'blank' : 'not blank' Which seems illogical. -- https://bugs.ruby-lang.org/