Module: RuboCop::Cop::VariableForce::Branchable Private

Included in:
Assignment, Reference
Defined in:
lib/rubocop/cop/variable_force/branchable.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Mix-in module for classes which own a node and need branch information of the node. The user classes must implement #node and #scope.

Instance Method Summary collapse

Instance Method Details

#branchObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
12
13
# File 'lib/rubocop/cop/variable_force/branchable.rb', line 9

def branch
  return @branch if instance_variable_defined?(:@branch)

  @branch = Branch.of(node, scope: scope)
end

#run_exclusively_with?(other) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/rubocop/cop/variable_force/branchable.rb', line 15

def run_exclusively_with?(other)
  return false if !branch || !other.branch

  branch.exclusive_with?(other.branch)
end