Class: Solve::Demand
- Inherits:
-
Object
- Object
- Solve::Demand
- Defined in:
- lib/solve/demand.rb
Instance Attribute Summary collapse
-
#constraint ⇒ Semverse::Constraint
readonly
The acceptable constraint of the artifact this demand is for.
-
#name ⇒ String
readonly
The name of the artifact this demand is for.
-
#solver ⇒ Solve::RubySolver, Solve::GecodeSolver
readonly
A reference to the solver this demand belongs to.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
-
#initialize(solver, name, constraint = Semverse::DEFAULT_CONSTRAINT) ⇒ Demand
constructor
A new instance of Demand.
- #to_s ⇒ Object
Constructor Details
#initialize(solver, name, constraint = Semverse::DEFAULT_CONSTRAINT) ⇒ Demand
Returns a new instance of Demand.
21 22 23 24 25 |
# File 'lib/solve/demand.rb', line 21 def initialize(solver, name, constraint = Semverse::DEFAULT_CONSTRAINT) @solver = solver @name = name @constraint = Semverse::Constraint.coerce(constraint) end |
Instance Attribute Details
#constraint ⇒ Semverse::Constraint (readonly)
The acceptable constraint of the artifact this demand is for
16 17 18 |
# File 'lib/solve/demand.rb', line 16 def constraint @constraint end |
#name ⇒ String (readonly)
The name of the artifact this demand is for
11 12 13 |
# File 'lib/solve/demand.rb', line 11 def name @name end |
#solver ⇒ Solve::RubySolver, Solve::GecodeSolver (readonly)
A reference to the solver this demand belongs to
6 7 8 |
# File 'lib/solve/demand.rb', line 6 def solver @solver end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
31 32 33 34 35 |
# File 'lib/solve/demand.rb', line 31 def ==(other) other.is_a?(self.class) && name == other.name && constraint == other.constraint end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/solve/demand.rb', line 27 def to_s "#{name} (#{constraint})" end |