Sha256: 9a2712ae06f01d9dc810a6a4c8819cf45bc4069913430a82f122f8387eb0a6be

Contents?: true

Size: 585 Bytes

Versions: 7104

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

module RuboCop
  module Cop
    class VariableForce
      # Mix-in module for classes which own a node and need branch information
      # of the node. The user classes must implement #node and #scope.
      module Branchable
        def branch
          return @branch if instance_variable_defined?(:@branch)

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

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

          branch.exclusive_with?(other.branch)
        end
      end
    end
  end
end

Version data entries

7,104 entries across 7,065 versions & 49 rubygems

Version Path
rubocop-0.60.0 lib/rubocop/cop/variable_force/branchable.rb
rubocop-0.59.2 lib/rubocop/cop/variable_force/branchable.rb
rubocop-0.59.1 lib/rubocop/cop/variable_force/branchable.rb
rubocop-0.59.0 lib/rubocop/cop/variable_force/branchable.rb