Class: Doubleshot::Resolver::GemResolver::Dependency
- Defined in:
- lib/doubleshot/resolver/gem_resolver/dependency.rb
Instance Attribute Summary collapse
-
#artifact ⇒ Doubleshot::Resolver::GemResolver::Artifact
readonly
A reference to the artifact this dependency belongs to.
-
#constraint ⇒ Gem::Requirement
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?)
-
#delete ⇒ Doubleshot::Resolver::GemResolver::Dependency?
Remove this dependency from the artifact it belongs to.
-
#initialize(artifact, name, constraint = ">= 0") ⇒ Dependency
constructor
A new instance of Dependency.
Constructor Details
#initialize(artifact, name, constraint = ">= 0") ⇒ Dependency
Returns a new instance of Dependency.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/doubleshot/resolver/gem_resolver/dependency.rb', line 23 def initialize(artifact, name, constraint = ">= 0") @artifact = artifact @name = name @constraint = case constraint when Gem::Requirement constraint else Gem::Requirement.new(constraint) end end |
Instance Attribute Details
#artifact ⇒ Doubleshot::Resolver::GemResolver::Artifact (readonly)
A reference to the artifact this dependency belongs to
8 9 10 |
# File 'lib/doubleshot/resolver/gem_resolver/dependency.rb', line 8 def artifact @artifact end |
#constraint ⇒ Gem::Requirement (readonly)
The constraint requirement of this dependency
18 19 20 |
# File 'lib/doubleshot/resolver/gem_resolver/dependency.rb', line 18 def constraint @constraint end |
#name ⇒ String (readonly)
The name of the artifact this dependency represents
13 14 15 |
# File 'lib/doubleshot/resolver/gem_resolver/dependency.rb', line 13 def name @name end |
Instance Method Details
#==(other) ⇒ Boolean Also known as: eql?
48 49 50 51 52 |
# File 'lib/doubleshot/resolver/gem_resolver/dependency.rb', line 48 def ==(other) other.is_a?(self.class) && self.artifact == other.artifact && self.constraint == other.constraint end |
#delete ⇒ Doubleshot::Resolver::GemResolver::Dependency?
Remove this dependency from the artifact it belongs to
37 38 39 40 41 42 43 |
# File 'lib/doubleshot/resolver/gem_resolver/dependency.rb', line 37 def delete unless artifact.nil? result = artifact.remove_dependency(self) @artifact = nil result end end |