Class: RuboCop::Cop::HashAlignment::TableAlignment
- Inherits:
-
Object
- Object
- RuboCop::Cop::HashAlignment::TableAlignment
- Includes:
- ValueAlignment
- Defined in:
- lib/rubocop/cop/mixin/hash_alignment.rb
Overview
Handles calculation of deltas when the enforced style is ‘table’.
Instance Method Summary collapse
-
#deltas_for_first_pair(first_pair, node) ⇒ Object
The table style is the only one where the first key-value pair can be considered to have bad alignment.
Methods included from ValueAlignment
Instance Method Details
#deltas_for_first_pair(first_pair, node) ⇒ Object
The table style is the only one where the first key-value pair can be considered to have bad alignment.
59 60 61 62 63 64 65 66 67 |
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 59 def deltas_for_first_pair(first_pair, node) self.max_key_width = node.keys.map { |key| key.source.length }.max separator_delta = separator_delta(first_pair, first_pair, 0) { separator: separator_delta, value: value_delta(first_pair, first_pair) - separator_delta } end |