Class: TerminalWriter

Inherits:
Writer
  • Object
show all
Defined in:
lib/teuton-get/writer/terminal_writer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTerminalWriter

Returns a new instance of TerminalWriter.



8
9
10
# File 'lib/teuton-get/writer/terminal_writer.rb', line 8

def initialize
  @quiet = false
end

Instance Attribute Details

#quietObject

Returns the value of attribute quiet.



6
7
8
# File 'lib/teuton-get/writer/terminal_writer.rb', line 6

def quiet
  @quiet
end

Instance Method Details

#write(text = "", args = {}) ⇒ Object



12
13
14
# File 'lib/teuton-get/writer/terminal_writer.rb', line 12

def write(text = "", args = {})
  print TeutonGet::Format.colorize(text, args[:color])
end

#write_table(rows) ⇒ Object



20
21
22
23
# File 'lib/teuton-get/writer/terminal_writer.rb', line 20

def write_table(rows)
  table = TTY::Table.new(rows)
  puts table.render(:ascii)
end

#writeln(text = "", args = {}) ⇒ Object



16
17
18
# File 'lib/teuton-get/writer/terminal_writer.rb', line 16

def writeln(text = "", args = {})
  write("#{text}\n", args)
end