Sha256: f384cac4cc389c44956623c5093e01ed3b19ec4c3b98fd7ed6381551966bfb4d

Contents?: true

Size: 1.79 KB

Versions: 197

Compression:

Stored size: 1.79 KB

Contents

# frozen_string_literal: true

module Bundler::Molinillo
  # A state that a {Resolution} can be in
  # @attr [String] name the name of the current requirement
  # @attr [Array<Object>] requirements currently unsatisfied requirements
  # @attr [DependencyGraph] activated the graph of activated dependencies
  # @attr [Object] requirement the current requirement
  # @attr [Object] possibilities the possibilities to satisfy the current requirement
  # @attr [Integer] depth the depth of the resolution
  # @attr [Hash] conflicts unresolved conflicts, indexed by dependency name
  # @attr [Array<UnwindDetails>] unused_unwind_options unwinds for previous conflicts that weren't explored
  ResolutionState = Struct.new(
    :name,
    :requirements,
    :activated,
    :requirement,
    :possibilities,
    :depth,
    :conflicts,
    :unused_unwind_options
  )

  class ResolutionState
    # Returns an empty resolution state
    # @return [ResolutionState] an empty state
    def self.empty
      new(nil, [], DependencyGraph.new, nil, nil, 0, {}, [])
    end
  end

  # A state that encapsulates a set of {#requirements} with an {Array} of
  # possibilities
  class DependencyState < ResolutionState
    # Removes a possibility from `self`
    # @return [PossibilityState] a state with a single possibility,
    #  the possibility that was removed from `self`
    def pop_possibility_state
      PossibilityState.new(
        name,
        requirements.dup,
        activated,
        requirement,
        [possibilities.pop],
        depth + 1,
        conflicts.dup,
        unused_unwind_options.dup
      ).tap do |state|
        state.activated.tag(state)
      end
    end
  end

  # A state that encapsulates a single possibility to fulfill the given
  # {#requirement}
  class PossibilityState < ResolutionState
  end
end

Version data entries

197 entries across 197 versions & 5 rubygems

Version Path
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/bundler-2.3.5/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.27 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.27 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/bundler-2.3.5/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.2.34 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.2.34 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
tdiary-5.2.4 vendor/bundle/ruby/3.1.0/gems/bundler-2.3.7/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.26 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.26 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.25 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.25 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.24 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.24 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.23 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.23 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.22 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.22 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.21 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb
bundler-2.3.21 lib/bundler/vendor/molinillo/lib/molinillo/state.rb
rubygems-update-3.3.20 bundler/lib/bundler/vendor/molinillo/lib/molinillo/state.rb