class RuboCop::Cop::Layout::FirstHashElementLineBreak
This cop 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
autocorrect(node)
click to toggle source
# File lib/rubocop/cop/layout/first_hash_element_line_break.rb, line 31 def autocorrect(node) EmptyLineCorrector.insert_before(node) end
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