Module: Wirble

Defined in:
lib/wirble.rb

Overview

Wirble: A collection of useful Irb features.

To use, add the following to your ~/.irbrc:

require 'rubygems'
require 'wirble'
Wirble.init

If you want color in Irb, add this to your ~/.irbrc as well:

Wirble.colorize

Note: I spent a fair amount of time documenting this code in the README. If you’ve installed via RubyGems, root around your cache a little bit (or fire up gem_server) and read it before you tear your hair out sifting through the code below.

Defined Under Namespace

Modules: Colorize, Internals, RiShortcut, Shortcuts Classes: History

Constant Summary collapse

VERSION =
'0.1.3'

Class Method Summary collapse

Class Method Details

.colorize(custom_colors = nil) ⇒ Object

Enable color results.



505
506
507
# File 'lib/wirble.rb', line 505

def self.colorize(custom_colors = nil)
  Colorize.enable(custom_colors)
end

.init(opt = nil) ⇒ Object

Load everything except color.



512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/wirble.rb', line 512

def self.init(opt = nil)
  # make sure opt isn't nil
  opt ||= {}

  # load internal irb/ruby features
  Internals.init(opt) unless opt && opt[:skip_internals]

  # load the history
  History.new(opt) unless opt && opt[:skip_history]

  # load shortcuts
  unless opt && opt[:skip_shortcuts]
    # load ri shortcuts
    RiShortcut.init

    # include common shortcuts
    Object.class_eval { include Shortcuts }
  end

  colorize(opt[:colors]) if opt && opt[:init_colors]
end