Tab completion in irb

October 7, 2006 at 7:59 am 8 comments

irb has tab completion support, you need to activate this by requiring ‘irb/completion’. You can load it when you invoke irb from the command line:


% irb -r irb/completion

Or you can load the completion library when irb is running:


% irb(main):005:0> require 'irb/completion'

If you often use tab completion then:

Linux users: Can create an alias in .bashrc by following these steps:

  • % vi ~/.bashrc
  • add alias irbtc="irb -r 'irb/completion'"
  • % source ~/.bashrc

Windows Users: Can create a file named irbtc.bat in your windows\system32 folder as irb -r "irb/completion" the file content.


Now you can run irb with tab completion support by:
% irbtc

Example:

% irbtc
irb(main):001:0> st="this is a string"
=> "this is a string"
irb(main):002:0> st.len
tab
irb(main):002:0> st.length
=> 16
irb(main):003:0> st.up
tabtab
st.upcase st.upcase! st.upto
irb(main):003:0> st.up

About these ads

Entry filed under: Ruby. Tags: .

What do you see a face or an Eskimo? Ruby On Rails India

8 Comments Add your own

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Important Notice…

I have moved this blog to http://webonrails.com . I will continue posting at http://webonrails.com, not on http://webonrails.wordpress.com.

Kindly update your book marks to http://webonrails.com

and http://webonrails.com/feed .

I am really very sorry for inconvenience.

Comming Soon….

Domain for Sale

TheRailsHosting.com


(Contact me)

Recent Posts

Calender

October 2006
M T W T F S S
« Sep   Nov »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Subscribe

  • Add to Google
  • Subscribe in NewsGator Online
  • Subscribe with Bloglines
  • WebOnRails on feedburner
  • technorati

del.icio.us

Feeds

Flickr Photos

A place called The Sun

Blavand afternoon shore

You always remember your first...

More Photos

Visitor’s Location

Blog Stats

  • 16,037 hits

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: