Almost Ruby and Rails developers use Interactive Ruby Shell(irb) everyday to test their code snippets. We all understand how useful and important to us on this tool. But sometime I find a little bit difficult when I want to test a chunk of codes in irb because I have to write them line by line. Ruby has block, method, class, module, etc. So we can’t write them easily in irb. Tell you the truth, I made a lot of mistakes on closing blocks.
Have you ever thought you can use your favorite text editors within irb to solve the problems? Thank to Jan Berkel and with help from Charles Nutter who make our dream comes truth, you can use any your favorite text editors(I like Vim) within irb. And it is so easy to get it installed.
- Install the interactive editor gem by running this at the command line:
gem install interactive_editor
- Create an
~/.irbrcfile if you don’t already have one, then paste the following into it:
require 'rubygems' require 'interactive_editor'
You can see a demo on Vimcasts