Module: RosettAi::Doctor::Check
- Included in:
- RosettAi::Doctor::Checks::CacheHealthCheck, RosettAi::Doctor::Checks::DbusAvailabilityCheck, RosettAi::Doctor::Checks::EngineDetectionCheck, RosettAi::Doctor::Checks::FilePermissionCheck, RosettAi::Doctor::Checks::GemDependencyCheck, RosettAi::Doctor::Checks::RubyVersionCheck, RosettAi::Doctor::Checks::StaleConfigNnccCheck, RosettAi::Doctor::Checks::StaleHomeNnccCheck
- Defined in:
- lib/rosett_ai/doctor/check.rb
Overview
Base interface for diagnostic checks.
Include this module and implement #perform to create a check. The #run method calls #perform and sets status/message/remediation.
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#message ⇒ String
readonly
Result description.
-
#remediation ⇒ String?
readonly
Remediation steps (nil when passing).
-
#status ⇒ Symbol
readonly
:pass, :warn, or :fail.
Class Method Summary collapse
-
.included(base) ⇒ Object
Register this check class with the Doctor module.
Instance Method Summary collapse
-
#name ⇒ String
Human-readable check name.
-
#run
Execute the check.
Instance Attribute Details
#message ⇒ String (readonly)
Returns result description.
25 26 27 |
# File 'lib/rosett_ai/doctor/check.rb', line 25 def @message end |
#remediation ⇒ String? (readonly)
Returns remediation steps (nil when passing).
28 29 30 |
# File 'lib/rosett_ai/doctor/check.rb', line 28 def remediation @remediation end |
#status ⇒ Symbol (readonly)
Returns :pass, :warn, or :fail.
22 23 24 |
# File 'lib/rosett_ai/doctor/check.rb', line 22 def status @status end |
Class Method Details
.included(base) ⇒ Object
Register this check class with the Doctor module.
40 41 42 |
# File 'lib/rosett_ai/doctor/check.rb', line 40 def self.included(base) base.extend(ClassMethods) end |
Instance Method Details
#name ⇒ String
Returns human-readable check name.
17 18 19 |
# File 'lib/rosett_ai/doctor/check.rb', line 17 def name self.class.check_name end |
#run
This method returns an undefined value.
Execute the check. Sets status, message, and remediation.
32 33 34 35 36 |
# File 'lib/rosett_ai/doctor/check.rb', line 32 def run perform rescue StandardError => e fail!(e., remediation: ::I18n.t('rosett_ai.doctor.unexpected_error')) end |