Module: RuboCop::Cop::CheckAssignment
- Included in:
- Layout::ElseAlignment, Layout::EndAlignment, Layout::IndentAssignment, Layout::IndentationWidth, Layout::MultilineAssignmentLayout
- Defined in:
- lib/rubocop/cop/mixin/check_assignment.rb
Overview
Common functionality for checking assignment nodes.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extract_rhs(node) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 23 def extract_rhs(node) if node.casgn_type? _scope, _lhs, rhs = *node elsif node.op_asgn_type? _lhs, _op, rhs = *node elsif Util::ASGN_NODES.include?(node.type) _lhs, rhs = *node elsif node.send_type? rhs = node.last_argument end rhs end |
Instance Method Details
#on_send(node) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 13 def on_send(node) rhs = extract_rhs(node) return unless rhs check_assignment(node, rhs) end |