Class: Vercon::Stdout
- Inherits:
-
Object
- Object
- Vercon::Stdout
- Defined in:
- lib/vercon/stdout.rb
Instance Method Summary collapse
- #erase(lines: nil) ⇒ Object
-
#initialize ⇒ Stdout
constructor
A new instance of Stdout.
- #write(message) ⇒ Object
Constructor Details
#initialize ⇒ Stdout
Returns a new instance of Stdout.
7 8 9 10 11 |
# File 'lib/vercon/stdout.rb', line 7 def initialize @stdout = $stdout @prompt = TTY::Prompt.new @lines = 0 end |
Instance Method Details
#erase(lines: nil) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/vercon/stdout.rb', line 18 def erase(lines: nil) (lines || @lines).times do @stdout.print("\e[A\e[K") @lines -= 1 end end |
#write(message) ⇒ Object
13 14 15 16 |
# File 'lib/vercon/stdout.rb', line 13 def write() @stdout.puts() @lines += .count("\n") + 1 end |