class Rufo::Formatter
def visit_bodystmt(node)
def visit_bodystmt(node) # [:bodystmt, body, rescue_body, else_body, ensure_body] # [:bodystmt, [[:@int, "1", [2, 1]]], nil, [[:@int, "2", [4, 1]]], nil] (2.6.0) _, body, rescue_body, else_body, ensure_body = node @inside_type_body = false line = @line indent_body body while rescue_body # [:rescue, type, name, body, more_rescue] _, type, name, body, more_rescue = rescue_body write_indent consume_keyword "rescue" if type skip_space write_space indent(@column) do visit_rescue_types(type) end end if name skip_space write_space consume_op "=>" skip_space write_space visit name end indent_body body rescue_body = more_rescue end if else_body # [:else, body] # [[:@int, "2", [4, 1]]] (2.6.0) write_indent consume_keyword "else" else_body = else_body[1] if else_body[0] == :else indent_body else_body end if ensure_body # [:ensure, body] write_indent consume_keyword "ensure" indent_body ensure_body[1] end write_indent if @line != line consume_keyword "end" end