The IRBThis is a featured page

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 IRB: To 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









rupakg
rupakg
Latest page update: made by rupakg , Oct 26 2007, 3:02 AM EDT (about this update About This Update rupakg Edited by rupakg

24 words added
3 words deleted
1 image added

view changes

- complete history)
Keyword tags: None
More Info: links to this page
There are no threads for this page.  Be the first to start a new thread.