The IRB |

Version Compare

Back to page history

Version User Scope of changes
Oct 26 2007, 3:02 AM EDT (current) rupakg 24 words added, 3 words deleted, 1 photo added
Oct 26 2007, 2:51 AM EDT rupakg 12 words added

Changes

Key:  Additions   Deletions

The infamous Ruby language console.



Try IRB in your browser: http://tryruby.hobix.com/


Shortcuts in IRB console

To "require" commonly used stuff in IRB, create a .irbrc file. Basically, this file is loaded by IRB so it has all your goodness and ready to go. In case of Windows, just create a text file with any name like rgirb.rc and place it anywhere you like e.g. C:\MyRailsProjects. Make sure to include this path including the filename in the IRBRC environment variable. So, it should look like IRBRC=C:\MyRailsProjects\rgirb.rc Now, fire up a command window from anywhere and run irb. If you see the familiar IRB prompt (irb(main):001:0>), you are all set. If you get an error that says something like "unterminated string meets end of file", open up the rgirb.rc file that you had created and look closely for the single quote character used. Make sure they look like ' and not like this. Take my word, there is a difference. Fix the quote and you will have the IRB prompt.


Auto-completion in IRBIRB: - toTo discover methods to call. Use [TAB key 2 times] to list the methods discovered for any object. Just include require 'irb/completion' in the irbrc file.

Auto-completion in IRB

Check out the whole article by Dr Nic.
Auto-tabbing in IRB: Just by including IRB.conf[:AUTO_INDENT]=true in the irbrc file you can get a very primitive tabbing or indentation in irb.

The IRB - Rails Cheatsheets