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
20 21 22 23 24 25 26 27 28 |
# File 'lib/tty/command/printers/abstract.rb', line 20 def initialize(output, = {}) @output = output @options = @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.
12 13 14 |
# File 'lib/tty/command/printers/abstract.rb', line 12 def err_data @err_data end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
11 12 13 |
# File 'lib/tty/command/printers/abstract.rb', line 11 def @options end |
#out_data ⇒ Object
Returns the value of attribute out_data.
12 13 14 |
# File 'lib/tty/command/printers/abstract.rb', line 12 def out_data @out_data end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
11 12 13 |
# File 'lib/tty/command/printers/abstract.rb', line 11 def output @output end |
Instance Method Details
#print_command_err_data(cmd, *args) ⇒ Object
38 39 40 |
# 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) ⇒ Object
42 43 44 |
# 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) ⇒ Object
34 35 36 |
# 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) ⇒ Object
30 31 32 |
# 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) ⇒ Object
46 47 48 |
# File 'lib/tty/command/printers/abstract.rb', line 46 def write(cmd, ) raise NotImplemented, "Abstract printer cannot be used" end |