Class: RuboCop::Cop::HashAlignmentStyles::KeywordSplatAlignment

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

Overview

Handles calculation of deltas for ‘kwsplat` nodes. This is a special case that just ensures the kwsplat is aligned with the rest of the hash since a `kwsplat` does not have a key, separator or value.

Instance Method Summary collapse

Instance Method Details

#deltas(first_pair, current_pair) ⇒ Object



146
147
148
149
150
151
152
# File 'lib/rubocop/cop/mixin/hash_alignment_styles.rb', line 146

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