Class: DatarocketsStyle::Cop::Layout::ArrayAlignmentExtended
- Inherits:
-
RuboCop::Cop::Cop
- Object
- RuboCop::Cop::Cop
- DatarocketsStyle::Cop::Layout::ArrayAlignmentExtended
- Includes:
- RuboCop::Cop::Alignment
- Defined in:
- lib/datarockets_style/cop/layout/array_alignment_extended.rb
Overview
Here we check if the elements of a multi-line array literal are aligned.
Constant Summary collapse
- ALIGN_PARAMS_MSG =
"Align the elements of an array literal if they span more than one line."- FIXED_INDENT_MSG =
"Use one level of indentation for elements " \ "following the first line of a multi-line array."
Instance Method Summary collapse
Instance Method Details
#autocorrect(node) ⇒ Object
50 51 52 |
# File 'lib/datarockets_style/cop/layout/array_alignment_extended.rb', line 50 def autocorrect(node) RuboCop::Cop::AlignmentCorrector.correct(processed_source, node, column_delta) end |
#on_array(node) ⇒ Object
44 45 46 47 48 |
# File 'lib/datarockets_style/cop/layout/array_alignment_extended.rb', line 44 def on_array(node) return if node.children.size < 2 check_alignment(node.children, base_column(node, node.children)) end |