Tags Ruby
irb is the interactive Ruby shell - an incredibly useful tool during development. Lisp folks are proud of the REPL (Read-Evaluate-Print Loop) - well, irb is REPL for Ruby. What turns irb into an even more useful instrument, however, is tab completion. First, it makes coding quicker by completing known symbols (kind of an Intellisense, if you'd like). Second, and more importantly, it allows you to quickly see which methods are implemented for objects, by typing:
irb(main):001:0> some_object.
And pressing TAB twice, irb will list all the methods. For some reason, however, irb doesn't come with tab completion out of the box. To set it up, you can create a batch file called irbb.bat, for instance, which calls:
irb -r irb/completion
And call that instead of irb. A simpler method, IMHO, is directly edit the irb.bat file in the Ruby installation bin/ directory to require irb/completion. P.S: I describe Windows solutions. It should be very similar for Linux.


comments powered by Disqus