123456789_123456789_123456789_123456789_123456789_

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

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/rubocop/cop/variable_force/branchable.rb

Overview

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

Instance Method Details

#branch

[ GitHub ]

  
# 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

[ GitHub ]

  
# 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