Class: Factorix::Dependency::Node
- Inherits:
-
Data
- Object
- Data
- Factorix::Dependency::Node
- Defined in:
- lib/factorix/dependency/node.rb,
lib/factorix/dependency/node.rb
Overview
Represents a MOD node in the dependency graph
Each node represents a MOD with its version, installation state, and enabled state. Operations can be planned on nodes (:enable, :disable, :install, :uninstall).
Instance Attribute Summary collapse
-
#enabled ⇒ Boolean
readonly
Whether the MOD is enabled.
-
#installed ⇒ Boolean
readonly
Whether the MOD is installed.
-
#mod ⇒ Factorix::MOD
readonly
The MOD identifier.
-
#operation ⇒ Symbol?
readonly
Planned operation (:enable, :disable, :install, :uninstall, nil).
-
#version ⇒ Factorix::MODVersion
readonly
The MOD version.
Instance Method Summary collapse
-
#enabled? ⇒ Boolean
Check if the MOD is enabled.
-
#initialize(mod:, version:, enabled: false, installed: false, operation: nil) ⇒ Node
constructor
A new instance of Node.
-
#inspect ⇒ String
Detailed inspection string.
-
#installed? ⇒ Boolean
Check if the MOD is installed.
-
#operation? ⇒ Boolean
Check if an operation is planned for this node.
-
#to_s ⇒ String
String representation of the node.
Constructor Details
#initialize(mod:, version:, enabled: false, installed: false, operation: nil) ⇒ Node
Returns a new instance of Node.
24 |
# File 'lib/factorix/dependency/node.rb', line 24 def initialize(mod:, version:, enabled: false, installed: false, operation: nil) = super |
Instance Attribute Details
#enabled ⇒ Boolean (readonly)
Returns Whether the MOD is enabled.
24 25 26 |
# File 'lib/factorix/dependency/node.rb', line 24 def enabled @enabled end |
#installed ⇒ Boolean (readonly)
Returns Whether the MOD is installed.
24 25 26 |
# File 'lib/factorix/dependency/node.rb', line 24 def installed @installed end |
#mod ⇒ Factorix::MOD (readonly)
Returns The MOD identifier.
24 25 26 |
# File 'lib/factorix/dependency/node.rb', line 24 def mod @mod end |
#operation ⇒ Symbol? (readonly)
Returns Planned operation (:enable, :disable, :install, :uninstall, nil).
24 25 26 |
# File 'lib/factorix/dependency/node.rb', line 24 def operation @operation end |
#version ⇒ Factorix::MODVersion (readonly)
Returns The MOD version.
24 25 26 |
# File 'lib/factorix/dependency/node.rb', line 24 def version @version end |
Instance Method Details
#enabled? ⇒ Boolean
Check if the MOD is enabled
29 |
# File 'lib/factorix/dependency/node.rb', line 29 def enabled? = enabled |
#inspect ⇒ String
Detailed inspection string
57 |
# File 'lib/factorix/dependency/node.rb', line 57 def inspect = "#<#{self.class.name} #{self}>" |
#installed? ⇒ Boolean
Check if the MOD is installed
34 |
# File 'lib/factorix/dependency/node.rb', line 34 def installed? = installed |
#operation? ⇒ Boolean
Check if an operation is planned for this node
39 |
# File 'lib/factorix/dependency/node.rb', line 39 def operation? = !operation.nil? |
#to_s ⇒ String
String representation of the node
44 45 46 47 48 49 50 51 52 |
# File 'lib/factorix/dependency/node.rb', line 44 def to_s state_flags = [] state_flags << "enabled" if enabled state_flags << "installed" if installed state_flags << "op:#{operation}" if operation state = state_flags.empty? ? "new" : state_flags.join(", ") "#{mod} v#{version} (#{state})" end |