Sha256: 1ae075300f9001753e85f11cd355587ca4f34cb30822451f3f8078f3c8b891f1

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

module Solve
  class Solver
    # @author Andrew Garson <andrew.garson@gmail.com>
    # @author Jamie Winsor <jamie@vialstudios.com>
    class ConstraintTable
      attr_reader :rows

      def initialize
        @rows = Array.new
      end

      def add(package, constraint, source)
        @rows << ConstraintRow.new(package, constraint, source)
      end

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

      def remove_constraints_from_source!(source)
        @rows.reject! { |row| row.source == source }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solve-0.3.0 lib/solve/solver/constraint_table.rb