class TTY::Command::Printers::Abstract
Attributes
err_data[RW]
options[R]
out_data[RW]
output[R]
Public Class Methods
new(output, options = {})
click to toggle source
Initialize a Printer object
@param [IO] output
the printer output
@api public
# File lib/tty/command/printers/abstract.rb, line 20 def initialize(output, options = {}) @output = output @options = options @enabled = options.fetch(:color, true) @color = ::Pastel.new(enabled: @enabled) @out_data = "" @err_data = "" end
Public Instance Methods
print_command_err_data(cmd, *args)
click to toggle source
# File lib/tty/command/printers/abstract.rb, line 38 def print_command_err_data(cmd, *args) write(args.join(" ")) end
print_command_exit(cmd, *args)
click to toggle source
# File lib/tty/command/printers/abstract.rb, line 42 def print_command_exit(cmd, *args) write(args.join(" ")) end
print_command_out_data(cmd, *args)
click to toggle source
# File lib/tty/command/printers/abstract.rb, line 34 def print_command_out_data(cmd, *args) write(args.join(" ")) end
print_command_start(cmd, *args)
click to toggle source
# File lib/tty/command/printers/abstract.rb, line 30 def print_command_start(cmd, *args) write(cmd.to_command + "#{args.join}") end
write(cmd, message)
click to toggle source
# File lib/tty/command/printers/abstract.rb, line 46 def write(cmd, message) raise NotImplemented, "Abstract printer cannot be used" end