Module: RuboCop::Cop::CheckAssignment
Relationships & Source Files | |
Extension / Inclusion / Inheritance Descendants | |
Included In:
| |
Defined in: | lib/rubocop/cop/mixin/check_assignment.rb |
Overview
Common functionality for checking assignment nodes.
Class Method Summary
- .extract_rhs(node) mod_func
Instance Method Summary
-
#on_and_asgn(node)
Alias for #on_lvasgn.
-
#on_casgn(node)
Alias for #on_lvasgn.
-
#on_cvasgn(node)
Alias for #on_lvasgn.
-
#on_gvasgn(node)
Alias for #on_lvasgn.
-
#on_ivasgn(node)
Alias for #on_lvasgn.
- #on_lvasgn(node) (also: #on_ivasgn, #on_cvasgn, #on_gvasgn, #on_casgn, #on_masgn, #on_op_asgn, #on_or_asgn, #on_and_asgn)
-
#on_masgn(node)
Alias for #on_lvasgn.
-
#on_op_asgn(node)
Alias for #on_lvasgn.
-
#on_or_asgn(node)
Alias for #on_lvasgn.
- #on_send(node)
Class Method Details
.extract_rhs(node) (mod_func)
[ GitHub ]# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 27
def extract_rhs(node) if node.call_type? node.last_argument elsif node.assignment? node.expression end end
Instance Method Details
#on_and_asgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 17
alias on_and_asgn on_lvasgn
#on_casgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 13
alias on_casgn on_lvasgn
#on_cvasgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 11
alias on_cvasgn on_lvasgn
#on_gvasgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 12
alias on_gvasgn on_lvasgn
#on_ivasgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 10
alias on_ivasgn on_lvasgn
#on_lvasgn(node) Also known as: #on_ivasgn, #on_cvasgn, #on_gvasgn, #on_casgn, #on_masgn, #on_op_asgn, #on_or_asgn, #on_and_asgn
[ GitHub ]# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 7
def on_lvasgn(node) check_assignment(node, extract_rhs(node)) end
#on_masgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 14
alias on_masgn on_lvasgn
#on_op_asgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 15
alias on_op_asgn on_lvasgn
#on_or_asgn(node)
Alias for #on_lvasgn.
# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 16
alias on_or_asgn on_lvasgn
#on_send(node)
[ GitHub ]# File 'lib/rubocop/cop/mixin/check_assignment.rb', line 19
def on_send(node) return unless (rhs = extract_rhs(node)) check_assignment(node, rhs) end