I really need to know how to clear the screen in Ruby. I've already looked all over and haven't found anything that can help.
I've already tried using cls in several formats and it NEVER worked (I am on Windows, btw).
All that happens is an arrow keeps showing up in the IRB console.
To clear the terminal window on multiple operational systems, you could use:
def clear
if Gem.win_platform?
system 'cls'
else
system 'clear'
end
end
Documentation for Gem#win_platform?
Is this a windows platform?
I found out earlier today that 'cls' doesn't work in RubyMine but it will work if I run the app in command prompt. It would've been nice if I had been told about that earlier.
在终端上键入“清除”,然后按Enter键,它将清除屏幕。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.