Low commit activity in last 3 years
A long-lived project that still receives updates
A fancy IRB has a colorful input prompt and profiles rocket-style #=> return values
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
 Dependencies

Development

~> 10.4
~> 3.2

Runtime

>= 0.9, < 3.0
 Project Readme

FancyIrb version [ci]

  • Colorizes IRB prompts, errors, $stderr and $stdout
  • Uses "Hash Rockets" (# =>) to display IRB results

Usage

require 'fancy_irb'
FancyIrb.start

You can pass an options hash. These are the default values:

DEFAULT_OPTIONS = {
  :rocket_mode     => true,       # activate or deactivate #=> rocket
  :rocket_prompt   => '#=> ',     # prompt to use for the rocket
  :result_prompt   => '=> ',      # prompt to use for normal output
  :unicode_display_width => true, # set to false if you don't want to check for proper
                                  # string width for better performance
  :colorize => {                  # colors hash. Set to nil to deactivate colors
    :rocket_prompt => [:blue],
    :result_prompt => [:blue],
    :input_prompt  => nil,
    :irb_errors    => [:red, :clean],
    :stderr        => [:red, :bright],
    :stdout        => nil,
    :input         => nil,
   },
}

Rocket mode means: Output result as comment if there is enough space left on the terminal line and stdout does not output more than the current terminal height.

For more information on which colors can be used, see the paint documentation.

Troubleshooting

Windows Support

You will need ansicon or ConEmu.

Need More Performance?

The gem checks for the Unicode display width of characters, which requires a lookup of every character. You can deactivate this check by setting :unicode_display_width to false.

Known Bugs

Not all stdin methods are patched properly to work with the rocket: The gems focuses on the often used ones

J-_-L

Inspired by the irb_rocket gem by genki.

Copyright (c) 2010-2012, 2015-2021 Jan Lelis https://janlelis.com released under the MIT license.