Sha256: 5ba97637515be15e54bcdb080bb0b0d6931a83dd2c500f2db6f31d72c583eff8

Contents?: true

Size: 716 Bytes

Versions: 7

Compression:

Stored size: 716 Bytes

Contents

module Solve
  class Solver
    class ConstraintTable
      attr_reader :rows

      def initialize
        @rows = Array.new
      end

      # @param [Solve::Dependency] dependency
      # @param [String, Symbol] source
      #
      # @return [Array<ConstraintRow>]
      def add(dependency, source)
        @rows << ConstraintRow.new(dependency, source)
      end

      def constraints_on_artifact(name)
        @rows.select do |row|
          row.name == name
        end.map { |row| row.constraint }
      end

      def remove_constraints_from_source!(source)
        from_source, others = @rows.partition { |row| row.source == source }
        @rows = others
        from_source
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
solve-0.8.2 lib/solve/solver/constraint_table.rb
solve-0.8.1 lib/solve/solver/constraint_table.rb
solve-0.8.0 lib/solve/solver/constraint_table.rb
solve-0.7.0 lib/solve/solver/constraint_table.rb
solve-0.6.1 lib/solve/solver/constraint_table.rb
solve-0.6.0 lib/solve/solver/constraint_table.rb
solve-0.5.0 lib/solve/solver/constraint_table.rb