Parent

Files

Class/Module Index [+]

Quicksearch

RuboCop::Cop::Style::AlignHash::AlignmentOfValues

Common functionality for the styles where not only keys, but also values are aligned.

Public Instance Methods

checkable_layout(node) click to toggle source
# File lib/rubocop/cop/style/align_hash.rb, line 33
def checkable_layout(node)
  !any_pairs_on_the_same_line?(node) && all_have_same_sparator?(node)
end
deltas(first_pair, _prev_pair, current_pair) click to toggle source
# File lib/rubocop/cop/style/align_hash.rb, line 37
def deltas(first_pair, _prev_pair, current_pair)
  key_delta = key_delta(first_pair, current_pair)
  current_separator = current_pair.loc.operator
  separator_delta = separator_delta(first_pair, current_separator,
                                    key_delta)
  value_delta = value_delta(first_pair, current_pair) -
    key_delta - separator_delta

  { key: key_delta, separator: separator_delta, value: value_delta }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.