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