DEV Community

loading...

Ruby: IRB tab-autocomplete

Nitin Reddy
I help software development and IT operations adopt NoSQL databases. In a previous avatar, I was technofunctional ERP consultant & built custom applications to extend the functionality of ERP systems.
・1 min read

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! :-)

Discussion (0)