Class: RuboCop::Cop::HashAlignment::KeyAlignment
- Inherits:
-
Object
- Object
- RuboCop::Cop::HashAlignment::KeyAlignment
- Defined in:
- lib/rubocop/cop/mixin/hash_alignment.rb
Overview
Handles calculation of deltas when the enforced style is ‘key’.
Instance Method Summary collapse
- #checkable_layout?(_node) ⇒ Boolean
- #deltas(first_pair, current_pair) ⇒ Object
- #deltas_for_first_pair(*_nodes) ⇒ Object
Instance Method Details
#checkable_layout?(_node) ⇒ 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_pair(*_nodes) ⇒ Object
13 14 15 |
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 13 def deltas_for_first_pair(*_nodes) {} end |