module RubbyCop::Cop::HashAlignment::ValueAlignment
Common functionality for checking alignment of hash values.
Public Instance Methods
checkable_layout?(node)
click to toggle source
# File lib/rubbycop/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)
click to toggle source
# File lib/rubbycop/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
Private Instance Methods
separator_delta(first_pair, current_pair, key_delta)
click to toggle source
# File lib/rubbycop/cop/mixin/hash_alignment.rb, line 44 def separator_delta(first_pair, current_pair, key_delta) if current_pair.hash_rocket? hash_rocket_delta(first_pair, current_pair) - key_delta else 0 end end