Class: Factorix::Dependency::Edge
- Inherits:
-
Data
- Object
- Data
- Factorix::Dependency::Edge
- Defined in:
- lib/factorix/dependency/edge.rb,
lib/factorix/dependency/edge.rb
Overview
Represents a dependency edge in the dependency graph
Each edge represents a dependency relationship from one MOD (dependent) to another MOD (dependency). The edge type indicates the nature of the relationship (required, optional, incompatible, etc.).
Constant Summary collapse
- REQUIRED =
Dependency types (from Factorix::Dependency::Entry)
Entry::REQUIRED
- OPTIONAL =
Entry::OPTIONAL
- HIDDEN_OPTIONAL =
Entry::HIDDEN_OPTIONAL
- INCOMPATIBLE =
Entry::INCOMPATIBLE
- LOAD_NEUTRAL =
Entry::LOAD_NEUTRAL
Instance Attribute Summary collapse
-
#from_mod ⇒ Factorix::MOD
readonly
MOD object (the dependent).
-
#to_mod ⇒ Factorix::MOD
readonly
MOD object (the dependency).
-
#type ⇒ Symbol
readonly
Dependency type.
-
#version_requirement ⇒ MODVersionRequirement?
readonly
Version requirement.
Instance Method Summary collapse
-
#hidden_optional? ⇒ Boolean
Check if this is a hidden optional dependency.
-
#incompatible? ⇒ Boolean
Check if this is an incompatibility relationship.
-
#initialize(from_mod:, to_mod:, type:, version_requirement: nil) ⇒ Edge
constructor
A new instance of Edge.
-
#inspect ⇒ String
Detailed inspection string.
-
#load_neutral? ⇒ Boolean
Check if this is a load-neutral dependency.
-
#optional? ⇒ Boolean
Check if this is an optional dependency.
-
#required? ⇒ Boolean
Check if this is a required dependency.
-
#satisfied_by?(version) ⇒ Boolean
Check if the given version satisfies this edge’s version requirement.
-
#to_s ⇒ String
String representation of the edge.
Constructor Details
#initialize(from_mod:, to_mod:, type:, version_requirement: nil) ⇒ Edge
Returns a new instance of Edge.
38 |
# File 'lib/factorix/dependency/edge.rb', line 38 def initialize(from_mod:, to_mod:, type:, version_requirement: nil) = super |
Instance Attribute Details
#from_mod ⇒ Factorix::MOD (readonly)
Returns MOD object (the dependent).
13 14 15 |
# File 'lib/factorix/dependency/edge.rb', line 13 def from_mod @from_mod end |
#to_mod ⇒ Factorix::MOD (readonly)
Returns MOD object (the dependency).
13 14 15 |
# File 'lib/factorix/dependency/edge.rb', line 13 def to_mod @to_mod end |
#type ⇒ Symbol (readonly)
Returns dependency type.
13 14 15 |
# File 'lib/factorix/dependency/edge.rb', line 13 def type @type end |
#version_requirement ⇒ MODVersionRequirement? (readonly)
Returns version requirement.
13 14 15 |
# File 'lib/factorix/dependency/edge.rb', line 13 def version_requirement @version_requirement end |
Instance Method Details
#hidden_optional? ⇒ Boolean
Check if this is a hidden optional dependency
53 |
# File 'lib/factorix/dependency/edge.rb', line 53 def hidden_optional? = type == HIDDEN_OPTIONAL |
#incompatible? ⇒ Boolean
Check if this is an incompatibility relationship
58 |
# File 'lib/factorix/dependency/edge.rb', line 58 def incompatible? = type == INCOMPATIBLE |
#inspect ⇒ String
Detailed inspection string
86 |
# File 'lib/factorix/dependency/edge.rb', line 86 def inspect = "#<#{self.class.name} #{self}>" |
#load_neutral? ⇒ Boolean
Check if this is a load-neutral dependency
63 |
# File 'lib/factorix/dependency/edge.rb', line 63 def load_neutral? = type == LOAD_NEUTRAL |
#optional? ⇒ Boolean
Check if this is an optional dependency
48 |
# File 'lib/factorix/dependency/edge.rb', line 48 def optional? = type == OPTIONAL || type == HIDDEN_OPTIONAL |
#required? ⇒ Boolean
Check if this is a required dependency
43 |
# File 'lib/factorix/dependency/edge.rb', line 43 def required? = type == REQUIRED |
#satisfied_by?(version) ⇒ Boolean
Check if the given version satisfies this edge’s version requirement
69 70 71 72 73 |
# File 'lib/factorix/dependency/edge.rb', line 69 def satisfied_by?(version) return true unless version_requirement version_requirement.satisfied_by?(version) end |
#to_s ⇒ String
String representation of the edge
78 79 80 81 |
# File 'lib/factorix/dependency/edge.rb', line 78 def to_s requirement_str = version_requirement ? " #{version_requirement}" : "" "#{from_mod} --[#{type}#{requirement_str}]--> #{to_mod}" end |