lib/tty/command/printers/abstract.rb in tty-command-0.7.0 vs lib/tty/command/printers/abstract.rb in tty-command-0.8.0

- old
+ new

@@ -9,22 +9,26 @@ extend Forwardable def_delegators :@color, :decorate attr_reader :output, :options + attr_accessor :out_data, :err_data # Initialize a Printer object # # @param [IO] output # the printer output # # @api public def initialize(output, options = {}) @output = output @options = options - @enabled = options.fetch(:color) { true } + @enabled = options.fetch(:color) { true } @color = ::Pastel.new(output: output, enabled: @enabled) + + @out_data = '' + @err_data = '' end def print_command_start(cmd, *args) write(cmd.to_command + "#{args.join}") end @@ -39,10 +43,10 @@ def print_command_exit(cmd, *args) write(args.join(' ')) end - def write(message) + def write(cmd, message) raise NotImplemented, "Abstract printer cannot be used" end end # Abstract end # Printers end # Command