class RuboCop::Cop::Layout::FirstHashElementLineBreak

Checks for a line break before the first element in a multi-line hash.

@example

# bad
{ a: 1,
  b: 2}

# good
{
  a: 1,
  b: 2 }

Constants

MSG

Public Instance Methods

on_hash(node) click to toggle source
# File lib/rubocop/cop/layout/first_hash_element_line_break.rb, line 25
def on_hash(node)
  # node.loc.begin tells us whether the hash opens with a {
  # If it doesn't, Style/FirstMethodArgumentLineBreak will handle it
  check_children_line_break(node, node.children) if node.loc.begin
end