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
57 58 59 |
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 57 def checkable_layout?(node) !node.pairs_on_same_line? && !node.mixed_delimiters? end |
#deltas(first_pair, current_pair) ⇒ Object
61 62 63 64 65 66 67 68 69 |
# File 'lib/rubocop/cop/mixin/hash_alignment.rb', line 61 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 |