README.rdoc

irbtools

The irbtools gem is a meta gem that installs handy and useful irb gems and
provides an appealing ready-to-use irb configuration. It has a modular
structure and supports multiple library-loading mechanisms, e.g. via
autoload or threads.

Setup

gem install irbtools

On Linux, you need xclip or xsel to use the clipboard:
sudo apt-get install xclip

This is irbtools “light”

When installing irbtools, some gems won't be installed to keep
windows support, e.g. better auto-completion or the looksee gem. These are
packaged in the irbtools-more gem. To
use them, you need to change your .irbrc to:

How to load more or less libraries

If you don't want to load the default set of irbtools gems, you will
have to use require 'irbtools/minimal' instead of
configure.

You have the following methods:

Irbtools.add_library(lib, options_hash, &block)

Irbtools.remove_library(lib)

The options_hash defines the way in which Irbtools loads the
library. Following options are possible

(no options)/:start

The library is required on startup before doing anything else (before
displaying the prompt)

:thread => identifier

After loading everything else, the library is required in a thread (while
continuing loading). You can choose any identifier, but if you take the
same one for multiple libraries, they will be loaded in the same thread (in
the order that you define)

:late => true

The library is required just before showing the prompt (note: loading
threads might still be in process)

:late_thread => identifier

Same as :thread, but after loading late libraries.

:sub_session => true

The library is loaded every time a sub-session starts (using
IRB.conf[:IRB_RC]). In ripl, ripl-after_rc
is used.

:autoload => :Constant

Use Ruby's autoload feature. It loads the library as soon as
the constant is encountered.

You can also apply a block that gets executed after the library is loaded
(except for autoload, the code will executed on startup in this case). You
can also just add callback block by using the
Irbtools.add_library_callback or the
Irbtools.replace_library_callback method.

When adding a new library, you should firstly consider some way to load it
via :autoload. If not possible, try loading via thread. If that is
not possible either, fallback to the default loading.

Troubleshooting: Unicode caused Wrong display widths?

When using double-width unicode chars, you need to paste the following
snippet to your .irbrc.