class RuboCop::Cop::Layout::MultilineMethodParameterLineBreaks
end
})
foo: “bar”,
def foo(a, b = {
# good
@example AllowMultilineFinalElement: true
end
})
foo: “bar”,
def foo(a, b = {
# bad
@example AllowMultilineFinalElement: false (default)
end
def foo(a, b, c)
# good
end
)
}
foo: “bar”,
b = {
a,
def foo(
# good
end
)
c
b,
a,
def foo(
# good
end
)
c
def foo(a, b,
# bad
@example
be on a separate line, see ‘Layout/FirstMethodParameterLineBreak`.
NOTE: This cop does not move the first argument, if you want that to
starts on a separate line.
Ensures that each parameter in a multi-line method definition
def ignore_last_element?
def ignore_last_element? !!cop_config['AllowMultilineFinalElement'] end
def on_def(node)
def on_def(node) return if node.arguments.empty? check_line_breaks(node, node.arguments, ignore_last: ignore_last_element?) end