class RuboCop::Cop::Style::MultilineHashBraceLayout

This cop checks that the closing brace in an a hash literal is symmetrical with respect to the opening brace and the hash elements.

If a hash's opening brace is on the same line as the first element of the hash, then the closing brace should be on the same line as the last element of the hash.

If a hash's opening brace is on a separate line from the first element of the hash, then the closing brace should be on the line after the last element of the hash.

@example

# bad
{ a: 'a',
  b: 'b'
}

# bad
{
  a: 'a',
  b: 'b' }

# good
{ a: 'a',
  b: 'b' }

#good
{
  a: 'a',
  b: 'b'
}

Constants

NEW_LINE_MESSAGE
SAME_LINE_MESSAGE

Public Instance Methods

on_hash(node) click to toggle source
# File lib/rubocop/cop/style/multiline_hash_brace_layout.rb, line 50
def on_hash(node)
  check_brace_layout(node)
end