class Rufo::Formatter

def visit_ternary_if(node)

def visit_ternary_if(node)
  # cond ? then : else
  #
  # [:ifop, cond, then_body, else_body]
  _, cond, then_body, else_body = node
  visit cond
  consume_space
  consume_op "?"
  skip_space
  if newline? || comment?
    consume_end_of_line
    write_indent(next_indent)
  else
    consume_space
  end
  visit then_body
  consume_space
  consume_op ":"
  skip_space
  if newline? || comment?
    consume_end_of_line
    write_indent(next_indent)
  else
    consume_space
  end
  visit else_body
end