irb Clear Screen
irb console doesn’t need much time to get cluttered. Here is a quick command to clear the irb console.
at the irb console type in the following:
On Windows:
system('cls') |
On Linux,Unix
system('clear') |
irb uses an initialization file in which you can set commonly used options or execute any required Ruby statements. When irb is run, it will try to load an initialization file from one of the following sources in order: ~/.irbrc, .irbrc, irb.rc, _irbrc, and $irbrc.
Within the initialization file you may run any arbitrary Ruby code. You can also set any of the configuration values that correspond to command-line arguments.
Armed with the above information you can create a file named .irbrc in your home directory and place the following code inside it. Now you can just use cls as the command to clear the irb console.
on Windows
c:\users\yourusername\.irbrc
OR
%userprofile%/.irbrc
def cls system('cls') end |
on Linux/unix
~/.irbrc
def cls system('clear') end |
Links: Interactive Ruby Shell