It seems that if I put code in my ternary evaluation it fails, but placing true or false it works.
Here is my code:
>test = [nil]
=> [nil]
>test.any? ? puts "AAA" : puts "BBB"
SyntaxError: (irb):16: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
test.any? ? puts "AAA" : puts "BBB"
^
(irb):16: syntax error, unexpected ':', expecting $end
test.any? ? puts "AAA" : puts "BBB"
>test.any? ? true : false
=> false
>test << 1
=> [nil, 1]
>test.any? ? true : false
=> true
>test.any? ? puts "AAA" : puts "BBB"
SyntaxError: (irb):14: syntax error, unexpected tSTRING_BEG, expecting keyword_do or '{' or '('
test.any? ? puts "AAA" : puts "BBB"
^
(irb):14: syntax error, unexpected ':', expecting $end
test.any? ? puts "AAA" : puts "BBB"
^
You need parentheses.
You should avoid parentheseless call in inline functions.