Class: Solve::Artifact
- Inherits:
- 
      Object
      
        - Object
- Solve::Artifact
 
- Includes:
- Comparable
- Defined in:
- lib/solve/artifact.rb
Instance Attribute Summary collapse
- 
  
    
      #graph  ⇒ Solve::Graph 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    A reference to the graph this artifact belongs to. 
- 
  
    
      #name  ⇒ String 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The name of the artifact. 
- 
  
    
      #version  ⇒ Semverse::Version 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The version of this artifact. 
Instance Method Summary collapse
- #<=>(other) ⇒ Integer
- #==(other) ⇒ Boolean (also: #eql?)
- 
  
    
      #dependencies  ⇒ Array<Solve::Dependency> 
    
    
  
  
  
  
  
  
  
  
  
    Return the collection of dependencies on this instance of artifact. 
- 
  
    
      #dependency(name, constraint)  ⇒ Solve::Artifact? 
    
    
  
  
  
  
  
  
  
  
  
    Retrieve the dependency from the artifact with the matching name and constraint. 
- 
  
    
      #dependency?(name, constraint)  ⇒ Boolean 
    
    
      (also: #has_dependency?)
    
  
  
  
  
  
  
  
  
  
    Check if the artifact has a dependency with the matching name and constraint. 
- 
  
    
      #depends(name, constraint = ">= 0.0.0")  ⇒ Solve::Artifact 
    
    
  
  
  
  
  
  
  
  
  
    Return the Solve::Dependency from the collection of dependencies with the given name and constraint. 
- 
  
    
      #initialize(graph, name, version)  ⇒ Artifact 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Artifact. 
- #to_s ⇒ Object
Constructor Details
#initialize(graph, name, version) ⇒ Artifact
Returns a new instance of Artifact.
| 23 24 25 26 27 28 | # File 'lib/solve/artifact.rb', line 23 def initialize(graph, name, version) @graph = graph @name = name @version = Semverse::Version.new(version) @dependencies = {} end | 
Instance Attribute Details
#graph ⇒ Solve::Graph (readonly)
A reference to the graph this artifact belongs to
| 8 9 10 | # File 'lib/solve/artifact.rb', line 8 def graph @graph end | 
#name ⇒ String (readonly)
The name of the artifact
| 13 14 15 | # File 'lib/solve/artifact.rb', line 13 def name @name end | 
#version ⇒ Semverse::Version (readonly)
The version of this artifact
| 18 19 20 | # File 'lib/solve/artifact.rb', line 18 def version @version end | 
Instance Method Details
#<=>(other) ⇒ Integer
| 102 103 104 | # File 'lib/solve/artifact.rb', line 102 def <=>(other) version <=> other.version end | 
#==(other) ⇒ Boolean Also known as: eql?
| 92 93 94 95 96 | # File 'lib/solve/artifact.rb', line 92 def ==(other) other.is_a?(self.class) && name == other.name && version == other.version end | 
#dependencies ⇒ Array<Solve::Dependency>
Return the collection of dependencies on this instance of artifact
| 55 56 57 | # File 'lib/solve/artifact.rb', line 55 def dependencies @dependencies.values end | 
#dependency(name, constraint) ⇒ Solve::Artifact?
Retrieve the dependency from the artifact with the matching name and constraint
| 48 49 50 | # File 'lib/solve/artifact.rb', line 48 def dependency(name, constraint) set_dependency(name, constraint) end | 
#dependency?(name, constraint) ⇒ Boolean Also known as: has_dependency?
Check if the artifact has a dependency with the matching name and constraint
| 37 38 39 | # File 'lib/solve/artifact.rb', line 37 def dependency?(name, constraint) !get_dependency(name, constraint).nil? end | 
#depends(name, constraint = ">= 0.0.0") ⇒ Solve::Artifact
Return the Solve::Dependency from the collection of dependencies with the given name and constraint.
| 77 78 79 80 81 82 83 | # File 'lib/solve/artifact.rb', line 77 def depends(name, constraint = ">= 0.0.0") unless dependency?(name, constraint) set_dependency(name, constraint) end self end | 
#to_s ⇒ Object
| 85 86 87 | # File 'lib/solve/artifact.rb', line 85 def to_s "#{name}-#{version}" end |