Monday, September 27, 2010

Ruby IRB Auto Completion and Highlight - Linux

Install wirble

laptop:~$ sudo gem install wirble
Successfully installed wirble-0.1.3
1 gem installed
Installing ri documentation for wirble-0.1.3...
Installing RDoc documentation for wirble-0.1.3...

vim ~/.irbrc
Put the following in this file:

require "rubygems"
require "wirble"

IRB.conf[:AUTO_INDENT] = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:LOAD_MODULES] = [] unless IRB.conf.key?(:LOAD_MODULES)
unless IRB.conf[:LOAD_MODULES].include?('irb/completion')
IRB.conf[:LOAD_MODULES] << 'irb/completion'


Thats it on irb prompt use tab for auto completion


Install random_data

laptop:~$ sudo gem install random_data
Successfully installed random_data-1.5.1
1 gem installed
Installing ri documentation for random_data-1.5.1...
Installing RDoc documentation for random_data-1.5.1...

-laptop:~$ irb
>> require 'rubygems'
=> false
>> require 'random_data'
=> true
Random.allocate Random.alphanumeric
>> Random.alphanumeric 11
=> "w1KbPVLzE2l"

No comments:

Post a Comment