Class: PuppetfileEditor::Logging Private
- Inherits:
-
Object
- Object
- PuppetfileEditor::Logging
- Defined in:
- lib/puppetfile_editor/cli.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Abstraction of logging methods for PuppetfileEditor::CLI
Instance Method Summary collapse
-
#initialize ⇒ Logging
constructor
private
A new instance of Logging.
- #log(message, message_type = :undef) ⇒ Object private
- #log_and_exit(message) ⇒ Object private
- #mod_message(mod, indent) ⇒ Object private
Constructor Details
#initialize ⇒ Logging
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Logging.
111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/puppetfile_editor/cli.rb', line 111 def initialize @statuses = { updated: "[ \e[32;1m+\e[0m ]", matched: "[ \e[0;1m=\e[0m ]", skipped: "[ \e[33;1m~\e[0m ]", not_found: "[ \e[0;1m-\e[0m ]", type_mismatched: "[ \e[31;1mx\e[0m ]", wont_upgrade: "[ \e[33;1m!\e[0m ]", warn: "[ \e[31;1m!!\e[0m ]", undef: '', } end |
Instance Method Details
#log(message, message_type = :undef) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
124 125 126 127 128 129 130 131 |
# File 'lib/puppetfile_editor/cli.rb', line 124 def log(, = :undef) if @statuses.key? status = @statuses[] else status = @statuses[:undef] end puts "#{status} #{}" end |
#log_and_exit(message) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
133 134 135 136 |
# File 'lib/puppetfile_editor/cli.rb', line 133 def log_and_exit() log(, :warn) exit 1 end |
#mod_message(mod, indent) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
138 139 140 |
# File 'lib/puppetfile_editor/cli.rb', line 138 def (mod, indent) log("#{mod.name.ljust(indent)} => #{mod.}", mod.status) end |