Class: RuboCop::Cop::HashAlignment::KeyAlignment

Inherits:
Object
  • Object
show all
Defined in:
lib/rubocop/cop/mixin/hash_alignment.rb

Overview

Handles calculation of deltas when the enforced style is ‘key’.

Instance Method Summary collapse

Instance Method Details

#checkable_layout?(_node) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 9

def checkable_layout?(_node)
  true
end

#deltas(first_pair, current_pair) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 17

def deltas(first_pair, current_pair)
  if Util.begins_its_line?(current_pair.source_range)
    { key: first_pair.key_delta(current_pair) }
  else
    {}
  end
end

#deltas_for_first_pairObject



13
14
15
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 13

def deltas_for_first_pair(*)
  {}
end