class Rufo::Formatter
def visit_def_from_name(name, params, body)
def visit_def_from_name(name, params, body) visit name params = [] if params.nil? params = params[1] if params[0] == :paren skip_space if current_token_kind == :on_lparen next_token skip_space skip_semicolons broken_across_line = false if empty_params?(params) skip_space_or_newline check :on_rparen next_token write "()" else write "(" if newline? || comment? broken_across_line = true indent(next_indent) do consume_end_of_line write_indent visit params end else indent(@column) do visit params end end skip_space_or_newline consume_keyword("nil") if current_token[1] == :on_kw check :on_rparen if broken_across_line write_line write_indent end write ")" next_token skip_space end elsif !empty_params?(params) if parens_in_def == :yes write "(" else write_space end visit params write ")" if parens_in_def == :yes skip_space end format_endless_method if current_token_kind == :on_op visit body end