Autocomplete and colorize your Ruby shell ( irb ) with wirble

Lets first install wirble

sudo gem install wirble

Add following lines to ~/.irbrc

#!/usr/bin/ruby 
require 'irb/completion'
require 'rubygems'
require 'wirble'

Wirble.init
Wirble.colorize

Now invoke irb.

$ irb
>>  1.m # press TAB here to auto complete
1.method   1.methods  1.modulo
>>  1.methods # press ENTER and the output will be colorized :)
=> ["%", "odd?", "inspect", "prec_i", "<<", "tap", "div", "&", "pretty_print", "po", "clone", ">>", "public_methods", "__send__", "object_id", "instance_var
iable_defined?", "equal?", "freeze", "to_sym", "*", "ord", "+", "extend", "next", "pretty_print_cycle", "send", "round", "methods", "prec_f", "-", "even?",s
ingleton_method_added", "divmod", "hash", "/", "integer?", "downto", "poc", "dup", "to_enum", "instance_variables", "|", "eql?", "size", "id", "instance_eva
l", "truncate", "~", "to_i", "singleton_methods", "modulo", "taint", "zero?", "times", "instance_variable_get", "frozen?", "enum_for", "display", "instance_
of?", "^", "method", "to_a", "+@", "pretty_print_inspect", "-@", "quo", "instance_exec", "type", "**", "upto", "to_f", "<", "step", "protected_methods", "<=
>", "between?", "==", "remainder", ">", "===", "ri", "to_int", "nonzero?", "pred", "instance_variable_set", "coerce", "respond_to?", "kind_of?", "floor", "s
ucc", ">=", "prec", "to_s", "<=", "pretty_inspect", "fdiv", "class", "private_methods", "=~", "tainted?", "__id__", "abs", "untaint", "nil?", "chr", "pretty
_print_instance_variables", "id2name", "is_a?", "ceil", "[]"]
About these ads