Class: TTY::Command::Printers::Abstract
- Inherits:
-
Object
- Object
- TTY::Command::Printers::Abstract
- Extended by:
- Forwardable
- Defined in:
- lib/tty/command/printers/abstract.rb
Instance Attribute Summary collapse
-
#err_data ⇒ Object
Returns the value of attribute err_data.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#out_data ⇒ Object
Returns the value of attribute out_data.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
Instance Method Summary collapse
-
#initialize(output, options = {}) ⇒ Abstract
constructor
Initialize a Printer object.
- #print_command_err_data(cmd, *args) ⇒ Object
- #print_command_exit(cmd, *args) ⇒ Object
- #print_command_out_data(cmd, *args) ⇒ Object
- #print_command_start(cmd, *args) ⇒ Object
- #write(cmd, message) ⇒ Object
Constructor Details
#initialize(output, options = {}) ⇒ Abstract
Initialize a Printer object
22 23 24 25 26 27 28 29 30 |
# File 'lib/tty/command/printers/abstract.rb', line 22 def initialize(output, = {}) @output = output = @enabled = .fetch(:color) { true } @color = ::Pastel.new(enabled: @enabled) @out_data = '' @err_data = '' end |
Instance Attribute Details
#err_data ⇒ Object
Returns the value of attribute err_data.
14 15 16 |
# File 'lib/tty/command/printers/abstract.rb', line 14 def err_data @err_data end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
13 14 15 |
# File 'lib/tty/command/printers/abstract.rb', line 13 def end |
#out_data ⇒ Object
Returns the value of attribute out_data.
14 15 16 |
# File 'lib/tty/command/printers/abstract.rb', line 14 def out_data @out_data end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
13 14 15 |
# File 'lib/tty/command/printers/abstract.rb', line 13 def output @output end |
Instance Method Details
#print_command_err_data(cmd, *args) ⇒ Object
40 41 42 |
# File 'lib/tty/command/printers/abstract.rb', line 40 def print_command_err_data(cmd, *args) write(args.join(' ')) end |
#print_command_exit(cmd, *args) ⇒ Object
44 45 46 |
# File 'lib/tty/command/printers/abstract.rb', line 44 def print_command_exit(cmd, *args) write(args.join(' ')) end |
#print_command_out_data(cmd, *args) ⇒ Object
36 37 38 |
# File 'lib/tty/command/printers/abstract.rb', line 36 def print_command_out_data(cmd, *args) write(args.join(' ')) end |
#print_command_start(cmd, *args) ⇒ Object
32 33 34 |
# File 'lib/tty/command/printers/abstract.rb', line 32 def print_command_start(cmd, *args) write(cmd.to_command + "#{args.join}") end |
#write(cmd, message) ⇒ Object
48 49 50 |
# File 'lib/tty/command/printers/abstract.rb', line 48 def write(cmd, ) raise NotImplemented, "Abstract printer cannot be used" end |