lib/rubocop/cop/style/method_def_parentheses.rb in rubocop-0.51.0 vs lib/rubocop/cop/style/method_def_parentheses.rb in rubocop-0.52.0

- old
+ new

@@ -27,27 +27,28 @@ correct_style_detected end end alias on_defs on_def - private - def autocorrect(node) lambda do |corrector| if node.args_type? # offense is registered on args node when parentheses are unwanted corrector.replace(node.loc.begin, ' ') corrector.remove(node.loc.end) else args_expr = node.arguments.source_range - args_with_space = range_with_surrounding_space(args_expr, :left) + args_with_space = range_with_surrounding_space(range: args_expr, + side: :left) just_space = range_between(args_with_space.begin_pos, args_expr.begin_pos) corrector.replace(just_space, '(') corrector.insert_after(args_expr, ')') end end end + + private def require_parentheses?(args) style == :require_parentheses || (style == :require_no_parentheses_except_multiline && args.multiline?)