From: nicoklein10@... Date: 2019-12-25T15:46:25+00:00 Subject: [ruby-core:96470] [Ruby master Feature#16451] Special terniary operators for methods ending in `?` Issue #16451 has been reported by myxoh (Nicolas Klein). ---------------------------------------- Feature #16451: Special terniary operators for methods ending in `?` https://bugs.ruby-lang.org/issues/16451 * Author: myxoh (Nicolas Klein) * Status: Open * Priority: Normal * Assignee: * Target version: ---------------------------------------- **Feature proposal** When a method ends in `?` we should be able to skip the `?` in the ternary operator So for example you'd be able to do `question_method? true_statement : false_statement` This shouldn't interfere with implementations as currently this fails to parse. ``` def normal_method true end ``` ``` def question_method? false end ``` Ternary operator: ``` question_method? 'was true' : 'was false' => 'was false' normal_method? 'was true' : 'was false' => method not found normal_method? normal_method ? 'was true' : 'was false' => 'was true' ``` and finally to preserve currently compatibility ``` question_method? ? 'was true' : 'was false' => 'was true' ``` -- https://bugs.ruby-lang.org/ Unsubscribe: