Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ruby clear screen [duplicate]

Possible Duplicate:
How can I clear the terminal in Ruby?

How to clear the terminal screen in ruby?

puts "hello, what's your name?"
input = gets.chomp
<<clearscreen>>
puts "nice to meet you, #{input}"
like image 794
Mr. Demetrius Michael Avatar asked Apr 21 '12 17:04

Mr. Demetrius Michael


People also ask

How do you clear a screen in Ruby?

Clearing the Console You can also use Ctrl + L to clear the screen, which works on both Mac and Linux. If you're on Windows, the only way we're aware of to clear the console is by typing system('cls') . The Windows cls command clears the screen, and the Ruby system method runs that command in a subshell.


1 Answers

Not sure what you're asking exactly, but there are different ways to clear irb / terminal in this post: How Do You Clear The IRB Console?

One that is intersting is

In order to clear the screen just do a

puts "\e[H\e[2J"

like image 68
Brett Sanders Avatar answered Oct 22 '22 05:10

Brett Sanders