Class: RuboCop::Cop::Yoshiki::Layout::EmptyLineAroundMultilineBlock
- Inherits:
-
Base
- Object
- Base
- RuboCop::Cop::Yoshiki::Layout::EmptyLineAroundMultilineBlock
- Extended by:
- AutoCorrector
- Includes:
- EmptyLineAroundMultilineStatement
- Defined in:
- lib/rubocop/cop/yoshiki/layout/empty_line_around_multiline_block.rb
Overview
Isolates a multiline block statement (do/end or a brace block)
from neighboring statements with a blank line.
Assigned blocks (text = gsub(REF) do … end, protect = lambda do)
are Yoshiki/Layout/EmptyLineAroundMultilineAssignment — the statement
is the assignment. This cop only fires when the block itself is the
statement (a sibling in a begin sequence).
Single-line blocks are left alone.
Constant Summary collapse
- MSG_BEFORE =
'Add a blank line before this multiline block.'.freeze
- MSG_AFTER =
'Add a blank line after this multiline block.'.freeze
Constants included from EmptyLineAroundMultilineStatement::Paragraph
EmptyLineAroundMultilineStatement::Paragraph::BLOCK_TYPES, EmptyLineAroundMultilineStatement::Paragraph::BODY_TYPES, EmptyLineAroundMultilineStatement::Paragraph::CONDITIONAL_TYPES
Instance Method Summary collapse
- #on_block(node) ⇒ Object (also: #on_numblock, #on_itblock)
Instance Method Details
#on_block(node) ⇒ Object Also known as: on_numblock, on_itblock
39 40 41 42 43 |
# File 'lib/rubocop/cop/yoshiki/layout/empty_line_around_multiline_block.rb', line 39 def on_block node return unless block_paragraph?(node) check_empty_lines_around(node) end |