Class: SolidObjects::Doctor::Report
- Inherits:
-
Object
- Object
- SolidObjects::Doctor::Report
- Defined in:
- lib/solid_objects/doctor.rb,
sig/generated/lib/solid_objects/doctor.rbs
Instance Attribute Summary collapse
- #checks ⇒ Object readonly
Instance Method Summary collapse
- #check(name) ⇒ Check
- #healthy? ⇒ Boolean
-
#initialize(checks:) ⇒ Report
constructor
A new instance of Report.
- #to_s ⇒ String
Constructor Details
#initialize(checks:) ⇒ Report
Returns a new instance of Report.
35 36 37 38 |
# File 'lib/solid_objects/doctor.rb', line 35 def initialize(checks:) @checks = checks.freeze freeze end |
Instance Attribute Details
#checks ⇒ Object (readonly)
32 33 34 |
# File 'lib/solid_objects/doctor.rb', line 32 def checks @checks end |
Instance Method Details
#check(name) ⇒ Check
46 47 48 49 |
# File 'lib/solid_objects/doctor.rb', line 46 def check(name) checks.find { |candidate| candidate.name == name } || raise(KeyError, "unknown doctor check #{name.inspect}") end |
#healthy? ⇒ Boolean
41 42 43 |
# File 'lib/solid_objects/doctor.rb', line 41 def healthy? checks.none?(&:failed?) end |
#to_s ⇒ String
52 53 54 55 56 57 58 59 60 |
# File 'lib/solid_objects/doctor.rb', line 52 def to_s lines = [ "Solid Objects doctor #{SolidObjects::VERSION}" ] lines.concat( checks.map do |check| "#{check.status.to_s.upcase.ljust(4)} #{check.name}: #{check.}" end ) lines.join("\n") end |