class RuboCop::Cop::Layout::BeginEndAlignment


end
do_something
foo ||= begin
# good
end
do_something
foo ||= begin
# bad
@example EnforcedStyleAlignWith: begin
end
do_something
foo ||= begin
# good
end
do_something
foo ||= begin
# bad
@example EnforcedStyleAlignWith: start_of_line (default)
These style can be configured by each cop.
align with the start of the line, it defaults to ‘EnforcedStyleAlignWith: start_of_line`.
by default. On the other hand, `||= begin` that this cop targets tends to
`Layout/EndAlignment` cop aligns with keywords (e.g. `if`, `while`, `case`)
`begin` keyword.
keyword is. If it’s set to ‘begin`, the `end` shall be aligned with the
`end` shall be aligned with the start of the line where the `begin`
parameter. If it’s set to ‘start_of_line` (which is the default), the
Two modes are supported through the `EnforcedStyleAlignWith` configuration
Checks whether the end keyword of `begin` is aligned properly.

def alignment_node(node)

def alignment_node(node)
  case style
  when :begin
    node
  else
    start_line_range(node)
  end
end

def autocorrect(corrector, node)

def autocorrect(corrector, node)
  AlignmentCorrector.align_end(corrector, processed_source, node, alignment_node(node))
end

def check_begin_alignment(node)

def check_begin_alignment(node)
  align_with = { begin: node.loc.begin, start_of_line: start_line_range(node) }
  check_end_kw_alignment(node, align_with)
end

def on_kwbegin(node)

def on_kwbegin(node)
  check_begin_alignment(node)
end