Class: FlutterRb::CheckReport
- Inherits:
-
Object
- Object
- FlutterRb::CheckReport
- Defined in:
- lib/flutter_rb/report/check_report.rb
Overview
Check report Represents a report for a specific check.
Instance Attribute Summary collapse
-
#check_name ⇒ Object
readonly
Reader for check_name attribute.
-
#check_report_status ⇒ Object
readonly
Reader for check_report_status attribute.
-
#message ⇒ Object
readonly
Reader for message attribute.
-
#path ⇒ Object
readonly
Reader for path attribute.
Instance Method Summary collapse
-
#color_for_report_status(check_report_status) ⇒ Symbol
Determines the color for the check report status.
-
#initialize(check_name, check_report_status, message, path) ⇒ CheckReport
constructor
Initializes a new instance of CheckReport.
-
#print(colorize: true) ⇒ String
Prints the check report.
Constructor Details
#initialize(check_name, check_report_status, message, path) ⇒ CheckReport
Initializes a new instance of CheckReport.
15 16 17 18 19 20 |
# File 'lib/flutter_rb/report/check_report.rb', line 15 def initialize(check_name, check_report_status, , path) @check_name = check_name @check_report_status = check_report_status @message = @path = path end |
Instance Attribute Details
#check_name ⇒ Object (readonly)
Reader for check_name attribute.
53 54 55 |
# File 'lib/flutter_rb/report/check_report.rb', line 53 def check_name @check_name end |
#check_report_status ⇒ Object (readonly)
Reader for check_report_status attribute.
56 57 58 |
# File 'lib/flutter_rb/report/check_report.rb', line 56 def check_report_status @check_report_status end |
#message ⇒ Object (readonly)
Reader for message attribute.
59 60 61 |
# File 'lib/flutter_rb/report/check_report.rb', line 59 def @message end |
#path ⇒ Object (readonly)
Reader for path attribute.
62 63 64 |
# File 'lib/flutter_rb/report/check_report.rb', line 62 def path @path end |
Instance Method Details
#color_for_report_status(check_report_status) ⇒ Symbol
Determines the color for the check report status.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/flutter_rb/report/check_report.rb', line 39 def color_for_report_status(check_report_status) case check_report_status when CheckReportStatus::NORMAL :green when CheckReportStatus::WARNING :yellow when CheckReportStatus::ERROR :red else :blue end end |
#print(colorize: true) ⇒ String
Prints the check report.
26 27 28 29 30 31 32 33 |
# File 'lib/flutter_rb/report/check_report.rb', line 26 def print(colorize: true) if colorize status_color = color_for_report_status(@check_report_status) " * [#{@check_report_status.colorize(status_color)}] #{@check_name}: #{@message}" else " * [#{@check_report_status}] #{@check_name}: #{@message}" end end |