Method: RuboCop::Cop::Style::HashSyntax#on_hash

Defined in:
lib/rubocop/cop/style/hash_syntax.rb

#on_hash(node) ⇒ Object



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/rubocop/cop/style/hash_syntax.rb', line 145

def on_hash(node)
  pairs = node.pairs

  return if pairs.empty?

  on_hash_for_mixed_shorthand(node)

  if style == :hash_rockets || force_hash_rockets?(pairs)
    hash_rockets_check(pairs)
  elsif style == :ruby19_no_mixed_keys
    ruby19_no_mixed_keys_check(pairs)
  elsif style == :no_mixed_keys
    no_mixed_keys_check(pairs)
  else
    ruby19_check(pairs)
  end
end