module SyntaxTree::Ternaryable

def ternaryable?(statement)

and default instead to breaking them into multiple lines.
parentheses around them. In this case we say they cannot be ternaried
Certain expressions cannot be reduced to a ternary without adding
def ternaryable?(statement)
  case statement
  when AliasNode, Assign, Break, Command, CommandCall, Defined, Heredoc,
       IfNode, IfOp, Lambda, MAssign, Next, OpAssign, RescueMod,
       ReturnNode, Super, Undef, UnlessNode, UntilNode, VoidStmt,
       WhileNode, YieldNode, ZSuper
    # This is a list of nodes that should not be allowed to be a part of a
    # ternary clause.
    false
  when Binary
    # If the user is using one of the lower precedence "and" or "or"
    # operators, then we can't use a ternary expression as it would break
    # the flow control.
    operator = statement.operator
    operator != :and && operator != :or
  else
    true
  end
end