Module: ConfigmonkeyCli::Application::OutputHelper
- Included in:
- ConfigmonkeyCli::Application
- Defined in:
- lib/configmonkey_cli/application/output_helper.rb
Instance Method Summary collapse
- #abort(msg, exit_code = 1) ⇒ Object
- #debug(msg, lvl = 1) ⇒ Object
- #error(msg) ⇒ Object
- #print(*a) ⇒ Object
- #puts(*a) ⇒ Object
- #warn(*a) ⇒ Object
Instance Method Details
#abort(msg, exit_code = 1) ⇒ Object
20 21 22 23 |
# File 'lib/configmonkey_cli/application/output_helper.rb', line 20 def abort msg, exit_code = 1 puts c("[ABORT] #{msg}", :red) exit(exit_code) end |
#debug(msg, lvl = 1) ⇒ Object
16 17 18 |
# File 'lib/configmonkey_cli/application/output_helper.rb', line 16 def debug msg, lvl = 1 puts c("[DEBUG] #{msg}", :black) if @opts[:debug] && @opts[:debug] >= lvl end |
#error(msg) ⇒ Object
25 26 27 |
# File 'lib/configmonkey_cli/application/output_helper.rb', line 25 def error msg warn c(msg, :red) end |
#print(*a) ⇒ Object
8 9 10 |
# File 'lib/configmonkey_cli/application/output_helper.rb', line 8 def print *a sync { @opts[:stdout].send(:print, *a) } end |
#puts(*a) ⇒ Object
4 5 6 |
# File 'lib/configmonkey_cli/application/output_helper.rb', line 4 def puts *a sync { @opts[:stdout].send(:puts, *a) } end |
#warn(*a) ⇒ Object
12 13 14 |
# File 'lib/configmonkey_cli/application/output_helper.rb', line 12 def warn *a sync { @opts[:stdout].send(:warn, *a) } end |