class RuboCop::Cop::Layout::FirstHashElementLineBreak
b: 2 }
a: 1,
{
# good
b: 2}
{ a: 1,
# bad
@example
multi-line hash.
This cop checks for a line break before the first element in a
def autocorrect(node)
def autocorrect(node) EmptyLineCorrector.insert_before(node) end
def on_hash(node)
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