Class: Doubleshot::Resolver::GemResolver::Solver::ConstraintTable
- Defined in:
- lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb
Instance Attribute Summary collapse
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
- #add(dependency, source) ⇒ Array<ConstraintRow>
- #constraints_on_artifact(name) ⇒ Object
-
#initialize ⇒ ConstraintTable
constructor
A new instance of ConstraintTable.
- #remove_constraints_from_source!(source) ⇒ Object
Constructor Details
#initialize ⇒ ConstraintTable
Returns a new instance of ConstraintTable.
8 9 10 |
# File 'lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb', line 8 def initialize @rows = Array.new end |
Instance Attribute Details
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
6 7 8 |
# File 'lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb', line 6 def rows @rows end |
Instance Method Details
#add(dependency, source) ⇒ Array<ConstraintRow>
16 17 18 |
# File 'lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb', line 16 def add(dependency, source) @rows << ConstraintRow.new(dependency, source) end |
#constraints_on_artifact(name) ⇒ Object
20 21 22 23 24 |
# File 'lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb', line 20 def constraints_on_artifact(name) @rows.select do |row| row.name == name end.map { |row| row.constraint } end |
#remove_constraints_from_source!(source) ⇒ Object
26 27 28 29 30 |
# File 'lib/doubleshot/resolver/gem_resolver/solver/constraint_table.rb', line 26 def remove_constraints_from_source!(source) from_source, others = @rows.partition { |row| row.source == source } @rows = others from_source end |