Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
I

irbtools

> 编程语言
Open source

Improvements for Ruby's IRB console ︎

925 stars0 likes1 views
WebsiteGitHub

About

Improvements for Ruby's IRB console ︎

Irbtools [version] [ci]

Irbtools 4 for Current IRB

The current version of Irbtools requires IRB 1.13+ (which Ruby version bundles which IRB?). Please use Irbtools 3 for earlier versions of IRB.

Description

Improves Ruby's IRB with:

  • a default configuration
  • improved syntax highlighting of result objects
  • helpful commands for debugging and introspection

Examples

Call system commands with $

ruby
>> $ git status # displays current git status

Show lookup chain and method list grouped by visibility

…

Show a method list grouped by ancestors

ruby
>> look "str"
.
.
.
Comparable
    >=  between?  clamp
String
  %            crypt                  inspect      squeeze!
  *            dedup                  intern       start_with?
  +            delete                 length       strip
  +@           delete!                lines        strip!
  -@           delete_prefix          ljust        sub
            delete_suffix          lstrip!      succ
.
.
.

Show source code of a Ruby-based method

…

Show source code of a natively implemented method

…

Find out method signatures (most useful for Ruby-based methods with keyword args)

ruby
>> howtocall require
require(path)
ruby
>> require "rubygems/user_interaction"
>> ui = Gem::ConsoleUI.new
>> howtocall ui.choose_from_list
choose_from_list(question, list)

Setup

$ gem install irbtools

IRB executes code in ~/.irbrc on start-up. If the file does not exist, yet, just create a new one. Add the following content:

require 'irbtools'

You also need to add irbtools to your project's Gemfile:

gem 'irbtools', require: 'irbtools/binding'

Then start IRB (with Irbtools loaded) from the terminal or directly from your code with:

binding.irb

Optional: If the binding_of_caller gem is available, you can just call the irb method and it will start a session with the current binding:

irb

Features

General IRB Improvements

  • Syntax highlighting (wirb / fancy_irb)
  • Loads included libraries efficiently to reduce IRB start-up time
  • Customizable views for specfic options using hirb. By default, ActiveRecord results get displayed as a table.

Included Debugging Methods for IRB

Highlights

  • Lookup and manipulate instance variables / methods with ease using object_shadow
  • Go even further with looksee, the best lookup path inspection tool out there
  • Display a method's source code using code
  • Find methods that turn one value into another value with methodfinder
  • Use VIM from inside IRB

Extra Commands

Commands get treated specially by IRB and do not necessarily follow Ruby syntax.

Command Alias Description Example
code - Shows syntax-highlighted source code of a method code Array#reverse
howtocall - Shows the method signature howtocall String#gsub
look - Shows looksee method list look [1,2,3]
shadow + Shows object shadow method list shadow [1,2,3]
sys $ Calls system shell $ top

Two default commands have an additional alias:

Command Alias Description Example
show_doc ri Shows documentation ri String#gsub
chws co "change into an object" co [1,2,3]
IRB's ls?

Please note that IRB's own ls command is aliased to ils, since ls already refers to a method listing all files in the current directory. If you haven't tried looksee (look) or object shadows (shadow) - give it a try ;)

Ruby Introspection

Method / Constant Arguments Description Provided By
Object#lp or Object#look Supercharged method introspection in IRB looksee
Object#shadow Manipulate instance variables and learn about callable methods object_shadow
code object = self, method_name Display the method source with syntax highlighting. Will also try to look up C methods. code
howtocall object = self, method_or_proc Display parameter names and types you will need to call a method debugging/howtocall
mf object1, object2 Find methods which turn one value into another value methodfinder

Platform Info

Method / Constant Arguments Description Provided By
OS Query operating system information os
RubyVersion Show the Ruby version ruby_version
RubyEngine Show the Ruby engine ruby_engine

General Utils

Method / Constant Arguments Description Provided By
beep Ring terminal bell debugging/beep
clear Clear the terminal every_day_irb
copy string Copy something to the clipboard clipboard
copy_output Copy session output history to the clipboard clipboard, irbtools
colorize string Syntax-highlight a string of Ruby code coderay, irbtools
ed / emacs / mate / mvim / nano / vi / vim filename = nil Start an editor in the session context interactive_editor
ld file Shortcut for load lib.to_s + '.rb' every_day_irb
pa string, color Print a string in the specified color paint
page what, options = {} Use pager to improve viewing longer content hirb, irbtools
paste Paste clipboard content clipboard
q *args Like Kernel#p, but prints results on one line, with different colors debugging/q
re string, regexg, groups = nil Regex debugging helper debugging/re
reset! Restart the current IRB session every_day_irb
rq lib Shortcut for require lib.to_s. Use it like this: rq:prime every_day_irb
rr lib Shortcut for require_relative lib.to_s every_day_irb
rrq / rerequire lib Hack to remove a library from $LOADED_FEATURES and require it again every_day_irb
wp inspect_string Syntax-highlight a Ruby return value wirb

Files and Navigation

| Method / Constant | Arguments | Description | Provided By | | ----------------- | ------------------- | --------------------------------------------------

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubydeveloper-toolsirbrubyruby-console

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言