Module: RuboCop::Cop::SafeAssignment

Extended by:
NodePattern::Macros
Included in:
Lint::AssignmentInCondition, RuboCop::Cop::Style::ParenthesesAroundCondition
Defined in:
lib/rubocop/cop/mixin/safe_assignment.rb

Overview

Common functionality for safe assignment. By safe assignment we mean putting parentheses around an assignment to indicate “I know I’m using an assignment as a condition. It’s not a mistake.”

Instance Method Summary collapse

Methods included from NodePattern::Macros

def_node_matcher, def_node_search, node_search_body

Instance Method Details

#safe_assignment_allowed?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rubocop/cop/mixin/safe_assignment.rb', line 15

def safe_assignment_allowed?
  cop_config['AllowSafeAssignment']
end