class RuboCop::Cop::Lint::DefEndAlignment
end
private def foo
@example
`def` keyword.
keyword is. If it’s set to ‘def`, the `end` shall be aligned with the
`end` shall be aligned with the start of the line where the `def`
parameter. If it’s set to ‘start_of_line` (which is the default), the
Two modes are supported through the AlignWith configuration
aligned properly.
This cop checks whether the end keywords of method definitions are
def on_method(node, _method_name, _args, _body)
def on_method(node, _method_name, _args, _body) check_offset_of_node(node) end
def on_send(node)
def on_send(node) receiver, method_name, *args = *node return unless visibility_and_def_on_same_line?(receiver, method_name, args) method_def = args.first if style == :start_of_line expr = node.loc.expression range = Parser::Source::Range.new(expr.source_buffer, expr.begin_pos, method_def.loc.keyword.end_pos) check_offset(method_def, range.source, method_def.loc.keyword.begin_pos - expr.begin_pos) else check_offset(method_def, 'def', 0) end ignore_node(method_def) # Don't check the same `end` again. end