Module: RuboCop::Cop::VariableForce::Branch Private
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Classes:
| |
Defined in: | lib/rubocop/cop/variable_force/branch.rb |
Overview
Namespace for branch classes for each control structure.
Constant Summary
-
CLASSES_BY_TYPE =
# File 'lib/rubocop/cop/variable_force/branch.rb', line 325Base.classes.each_with_object({}) do |klass, classes| classes[klass.type] = klass end
Class Method Summary
- .of(target_node, scope: nil) Internal use only
Class Method Details
.of(target_node, scope: nil)
[ GitHub ]# File 'lib/rubocop/cop/variable_force/branch.rb', line 8
def self.of(target_node, scope: nil) ([target_node] + target_node.ancestors).each do |node| return nil unless node.parent return nil unless scope.include?(node) klass = CLASSES_BY_TYPE[node.parent.type] next unless klass branch = klass.new(node, scope) return branch if branch.branched? end nil end