Exception: PgVerify::Doctor::DoctorError
- Inherits:
-
Core::Error
- Object
- StandardError
- Core::Error
- PgVerify::Doctor::DoctorError
- Defined in:
- lib/pg-verify/doctor/doctor.rb
Instance Method Summary collapse
- #formatted ⇒ Object
-
#initialize(warnings) ⇒ DoctorError
constructor
A new instance of DoctorError.
Methods inherited from Core::Error
Constructor Details
#initialize(warnings) ⇒ DoctorError
Returns a new instance of DoctorError.
7 8 9 |
# File 'lib/pg-verify/doctor/doctor.rb', line 7 def initialize(warnings) @warnings = warnings end |
Instance Method Details
#formatted ⇒ Object
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pg-verify/doctor/doctor.rb', line 10 def formatted() is_are, s = @warnings.length == 1 ? ["is", ""] : ["are", "s"] header = "There #{is_are} #{@warnings.length} warning#{s} for your installation:" string = @warnings.each_with_index.map { |w, i| title = "#{i + 1}) #{w.title}".c_warn body = w.text.indented(str: " ") "#{title}\n#{body}" }.join("\n\n") return header, string end |