Class: Doubleshot::Resolver::GemResolver::Demand
- Defined in:
- lib/doubleshot/resolver/gem_resolver/demand.rb
Instance Attribute Summary collapse
-
#constraint ⇒ Gem::Requirement
readonly
The acceptable constraint of the artifact this demand is for.
-
#name ⇒ String
readonly
The name of the artifact this demand is for.
-
#solver ⇒ Doubleshot::Resolver::GemResolver::Solver
readonly
A reference to the solver this demand belongs to.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#delete ⇒ Doubleshot::Resolver::GemResolver::Demand?
Remove this demand from the solver it belongs to.
-
#initialize(solver, name, constraint = ">= 0") ⇒ Demand
constructor
A new instance of Demand.
- #to_s ⇒ Object
Constructor Details
#initialize(solver, name, constraint = ">= 0") ⇒ Demand
Returns a new instance of Demand.
23 24 25 26 27 28 29 30 31 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 23 def initialize(solver, name, constraint = ">= 0") @solver = solver @name = name @constraint = if constraint.is_a?(Gem::Requirement) constraint else Gem::Requirement.new(constraint.to_s) end end |
Instance Attribute Details
#constraint ⇒ Gem::Requirement (readonly)
The acceptable constraint of the artifact this demand is for
18 19 20 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 18 def constraint @constraint end |
#name ⇒ String (readonly)
The name of the artifact this demand is for
13 14 15 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 13 def name @name end |
#solver ⇒ Doubleshot::Resolver::GemResolver::Solver (readonly)
A reference to the solver this demand belongs to
8 9 10 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 8 def solver @solver end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
48 49 50 51 52 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 48 def ==(other) other.is_a?(self.class) && self.name == other.name && self.constraint == other.constraint end |
#delete ⇒ Doubleshot::Resolver::GemResolver::Demand?
Remove this demand from the solver it belongs to
36 37 38 39 40 41 42 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 36 def delete unless solver.nil? result = solver.remove_demand(self) @solver = nil result end end |
#to_s ⇒ Object
44 45 46 |
# File 'lib/doubleshot/resolver/gem_resolver/demand.rb', line 44 def to_s "#{name} (#{constraint})" end |