Class: RuboCop::Cop::Tablecop::AlignMethods

Inherits:
Base
  • Object
show all
Extended by:
AutoCorrector
Defined in:
lib/rubocop/cop/tablecop/align_methods.rb

Overview

Aligns contiguous single-line method definitions so their bodies start at the same column. Aligns on ‘=` for endless methods; traditional one-liners align as if they had an invisible `=`.

Examples:

# bad
def foo = 1
def barbaz = 2

# good
def foo    = 1
def barbaz = 2

Mixed endless and traditional

# bad
def foo = 1
def bar() 2 end

# good
def foo   = 1
def bar()   2 end

Constant Summary collapse

MSG =
"Align method body with other methods in group"

Instance Method Summary collapse

Instance Method Details

#on_new_investigationObject



33
34
35
36
37
38
# File 'lib/rubocop/cop/tablecop/align_methods.rb', line 33

def on_new_investigation
  return if processed_source.blank?

  groups = find_method_groups
  groups.each { |group| check_group(group) }
end