DEV Community

Nitin Reddy
Nitin Reddy

Posted on

Ruby: IRB tab-autocomplete

Ruby's IRB is a pretty good environment to quickly test a snippet of code. And when you want to test a snippet of code, you do not necessarily know all of the methods and properties for the objects you are working with. If only there were a tab code-complete feature in IRB.

...which has been available in IRB since too-long-ago-to-remember.

What you neeed to do is run this one-line require and then you get autocomplete:

require 'irb/completion'
Enter fullscreen mode Exit fullscreen mode

For instance, type

'red'.cap
Enter fullscreen mode Exit fullscreen mode

and then press Tab. Auto-complete! :-)

Top comments (0)