Class: TerminalWriter
- Defined in:
- lib/teuton-get/writer/terminal_writer.rb
Instance Attribute Summary collapse
-
#quiet ⇒ Object
Returns the value of attribute quiet.
Instance Method Summary collapse
-
#initialize ⇒ TerminalWriter
constructor
A new instance of TerminalWriter.
- #write(text = "", args = {}) ⇒ Object
- #write_table(rows) ⇒ Object
- #writeln(text = "", args = {}) ⇒ Object
Constructor Details
#initialize ⇒ TerminalWriter
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
#quiet ⇒ Object
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 |