class Rufo::Formatter

def visit_defined(node)

def visit_defined(node)
  # [:defined, exp]
  _, exp = node
  consume_keyword "defined?"
  skip_space_or_newline
  has_paren = current_token_kind == :on_lparen
  if has_paren
    write "("
    next_token
    skip_space_or_newline
  else
    consume_space
  end
  # exp can be [:paren, exp] if there's a parentheses,
  # though not always (only if there's a space after `defined?`)
  if exp[0] == :paren
    exp = exp[1]
  end
  visit exp
  if has_paren
    skip_space_or_newline
    check :on_rparen
    write ")"
    next_token
  end
end