Method: TTY::Command::Printers::Pretty#write
- Defined in:
- lib/tty/command/printers/pretty.rb
#write(cmd, message, data = nil) ⇒ 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.
Write message out to output
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/tty/command/printers/pretty.rb', line 46 def write(cmd, , data = nil) cmd_set_uuid = cmd..fetch(:uuid, true) uuid_needed = cmd.[:uuid].nil? ? @uuid : cmd_set_uuid out = [] if uuid_needed out << "[#{decorate(cmd.uuid, :green)}] " unless cmd.uuid.nil? end out << "#{message}\n" target = (cmd.only_output_on_error && !data.nil?) ? data : output target << out.join end |