Class: RightConf::StdoutReporter
- Inherits:
-
BaseReporter
- Object
- BaseReporter
- RightConf::StdoutReporter
- Defined in:
- lib/rconf/progress_reporters/stdout_reporter.rb
Overview
STDOUT progress reporter, logs progress to console
Instance Method Summary collapse
-
#format_check(check) ⇒ Object
Format check, should be followed by
report_success
orreport_failure
. -
#format_failure ⇒ Object
Format check failure.
-
#format_fatal(error) ⇒ Object
Format fatal error and raise exception to stop execution.
-
#format_section(section) ⇒ Object
Format new progress report section.
-
#format_success ⇒ Object
Format check success.
-
#write(text) ⇒ Object
Print given text to STDOUT.
Methods inherited from BaseReporter
#method_missing, #report_result
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RightConf::BaseReporter
Instance Method Details
#format_check(check) ⇒ Object
Format check, should be followed by report_success
or report_failure
Parameters
- check(String)
-
Check title
Return
- text(String)
-
Formatted text
49 50 51 |
# File 'lib/rconf/progress_reporters/stdout_reporter.rb', line 49 def format_check(check) text = super(check) end |
#format_failure ⇒ Object
Format check failure
Return
- text(String)
-
Formatted text
65 66 67 |
# File 'lib/rconf/progress_reporters/stdout_reporter.rb', line 65 def format_failure text = super.red end |
#format_fatal(error) ⇒ Object
Format fatal error and raise exception to stop execution
Return
- text(String)
-
Formatted text
73 74 75 76 77 78 |
# File 'lib/rconf/progress_reporters/stdout_reporter.rb', line 73 def format_fatal(error) text = super.split("\n") text[0] = text[0].red.bold text[1] = text[1].red.bold if text.size > 1 text.join("\n") + "\n" end |
#format_section(section) ⇒ Object
Format new progress report section
Parameters
- section(String)
-
Section title
Return
- text(String)
-
Formatted text
38 39 40 |
# File 'lib/rconf/progress_reporters/stdout_reporter.rb', line 38 def format_section(section) text = super(section).green end |
#format_success ⇒ Object
Format check success
Return
- text(String)
-
Formatted text
57 58 59 |
# File 'lib/rconf/progress_reporters/stdout_reporter.rb', line 57 def format_success text = super.blue end |
#write(text) ⇒ Object
Print given text to STDOUT
Parameters
- text(String)
-
Text to be printed
Return
- true
-
Always return true
26 27 28 29 |
# File 'lib/rconf/progress_reporters/stdout_reporter.rb', line 26 def write(text) $stdout.print(text) true end |