Rib 1.0.4 released

Rib https://github.com/godfat/rib

by Lin Jen-Shin (godfat)


Ruby-Interactive-ruBy – Yet another interactive Ruby shell

Rib is based on the design of ripl and the work of ripl-rc, some
the features are also inspired by pry. The aim of Rib is to be fully
featured and yet very easy to opt-out or opt-in other features. It
be simple, lightweight and modular so that everyone could customize


gem install rib


As an interactive shell

As IRB (reads ~/.rib/config.rb writes ~/.rib/history.rb)


As Rails console

rib rails

You could also run in production and pass arguments normally as you’d
do in
rails console or ./script/console

rib rails production --sandbox --debugger

Note: You might need to add ruby-debug or ruby-debug19 to your Gemfile
you’re passing --debugger and using bundler together.

As Ramaze console

rib ramaze

As a console for whichever the app in the current path
it should be (for now, it’s either Rails or Ramaze)

rib auto

If you’re trying to use rib auto for a Rails app, you could also
arguments as if you were using rib rails. rib auto is merely

rib auto production --sandbox --debugger

As a fully featured interactive Ruby shell (as ripl-rc)

rib all

As a fully featured app console (yes, some commands could be used

rib all auto # or `rib auto all`, the order doesn't really matter

You can customize Rib’s behaviour by setting a config file located at
~/.rib/config.rb or ~/.config/rib/config.rb, or $RIB_HOME/ config.rb by
setting $RIB_HOME environment variable. Since it’s merely a Ruby
which would be loaded into memory before launching Rib shell session,
You can
put any customization or monkey patch there. Personally, I use all
provided by Rib.


As you can see, putting require 'rib/all' into config file is
exactly the
same as running rib all without a config file. What rib all would
do is
merely require the file, and that file is also merely requiring all
but without extra plugins, which you should enable them one by
one. This
is because most extra plugins are depending on other gems, or hard to
with other plugins, or having strong personal tastes, so you won’t
want to
enable them all. Suppose you only want to use the core plugins and
plugin, you’ll put this into your config file:

require 'rib/core'
require 'rib/more/color'

You can also write your plugins there. Here’s another example:

require 'rib/core'
require 'pp'
Rib.config[:prompt] = '$ '

module RibPP
  Rib::Shell.send(:include, self)

  def format_result result
    result_prompt + result.pretty_inspect

So that we override the original format_result to pretty_inspect the
You can also build your own gem and then simply require it in your
file. To see a list of overridable API, please read api.rb

Currently, there are two extra plugins.

  • require 'rib/extra/autoindent' This plugin is depending on:

    1. readline_buffer
    2. readline plugin
    3. multiline plugin
  • require 'rib/extra/hirb' This plugin is depending on:

    1. hirb

Basic configuration

Rib.config | Functionality


Rib.config[:config] | The path where config should be located
Rib.config[:name] | The name of this shell
Rib.config[:result_prompt] | Default is “=>”
Rib.config[:prompt] | Default is “>>”
Rib.config[:binding] | Context, default: TOPLEVEL_BINDING
Rib.config[:exit] | Commands to exit, default [nil] # control

Plugin specific configuration

Rib.config | Functionality


’ ’

As a debugging/interacting tool

Rib could be used as a kind of debugging tool which you can set break
in the source program.

require 'rib/config' # This would load your Rib config
require 'rib/more/anchor'
                     # If you enabled anchor in config, then

needed not
Rib.anchor binding # This would give you an interactive shell
# when your program has been executed here.
Rib.anchor 123 # You can also anchor on an object.

But this might be called in a loop, you might only want to
enter the shell under certain circumstance, then you’ll do:

require 'rib/debug'
Rib.enable_anchor do
  # Only `Rib.anchor` called in the block would launch a shell

Rib.anchor binding # No effect (no-op) outside the block

Anchor could also be nested. The level would be shown on the prompt,
starting from 1.

In place editing

Whenever you called:

require 'rib/more/edit'

Rib would open an editor according to $EDITOR (ENV['EDITOR']) for
After save and leave the editor, Rib would evaluate what you had
This also works inside an anchor. To use it, require either rib/more/
or rib/more or rib/all.

As a shell framework

The essence is:

require 'rib'

All others are optional. The core plugins are lying in rib/core/ *.rb, and
more plugins are lying in rib/more/*.rb. You can read rib/app/ ramaze.rb
and bin/rib-ramaze as a Rib App reference implementation, because
it’s very
simple, simpler than rib-rails.


Rib 1.0.4 – 2012-03-20

  • [core/multiline] Fixed a corner case:

    1/1.to_i +
  • [rib] Do not crash because of a loop error. Try to relaunch the

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs