Skip to content

janlelis/wirb

Repository files navigation

WIRB Interactive Ruby version

The WIRB gem adds syntax highlighting to inspected Ruby objects. It covers core Ruby classes/modules and most of standard library. Works best as your default REPL inspector, but also works without IRB.

Supports Ruby 3.x and 4.0.

Please note that WIRB also works well for Ruby 1 and Ruby 2 - just install the latest WIRB version possible to install.

Features

  • Syntax highlighting for inspected Ruby objects
  • Support for generic objects, especially enumerators, and nested generic objects
  • Supports common standard library objects
  • Color schemas customizable via YAML

Install

Install the gem with:

$ gem install wirb

Or add it to your Gemfile:

gem 'wirb'

Usage

To start IRB with WIRB activated for one session, do:

$ irb -r wirb --inspect wirb

To activate WIRB permanently, you can add this to the ~/.irbrc file:

require 'wirb'
Wirb.start

Another way would be to use Irbtools, which activates WIRB automatically.

Kernel#wp

WIRB comes with a pretty printing utility:

require 'wirb/wp'
wp some_object

Other than similar tools like pp or awesome_print, it will not change the format the highlighted objects by adding whitespace, but only adds colors.

Bundled Schemas

These are the bundled color schemas. You can load one with Wirb.load_schema(:name)

  • :classic (default)
  • :colorless (only uses :bright, :underline and :inverse effect)
  • :ultra (by @venantius, matches the colorscheme from Ultra over in Clojure-land)

Also See

Credits

Copyright (c) 2011-2025 Jan Lelis https://janlelis.com see COPYING for details.

First tokenizer version was based on the wirble gem: Copyright (C) 2006-2009 Paul Duncan [email protected]

All contributors