Module: RuboCop::Cop::HashAlignment::ValueAlignment
- Included in:
- SeparatorAlignment, TableAlignment
- Defined in:
- lib/rubocop/cop/mixin/hash_alignment.rb
Overview
Common functionality for checking alignment of hash values.
Instance Method Summary collapse
Instance Method Details
#checkable_layout?(node) ⇒ Boolean
28 29 30 |
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 28 def checkable_layout?(node) !node.pairs_on_same_line? && !node.mixed_delimiters? end |
#deltas(first_pair, current_pair) ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 32 def deltas(first_pair, current_pair) key_delta = key_delta(first_pair, current_pair) separator_delta = separator_delta(first_pair, current_pair, key_delta) value_delta = value_delta(first_pair, current_pair) - key_delta - separator_delta { key: key_delta, separator: separator_delta, value: value_delta } end |