GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - MacRuby/DietRB: IRB on a diet, for MacRuby / Ruby 1.9

BranchesTags
Open more actions menu

Latest commit

 

History

218 Commits
218 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
lib
lib
 
 
spec
spec
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.rdoc
README.rdoc
 
 
Rakefile
Rakefile
 
 
TODO
TODO
 
 
config_prototype.rb
config_prototype.rb
 
 
dietrb.gemspec
dietrb.gemspec
 
 

Repository files navigation

IRB on a diet, for MacRuby / Ruby 1.9

The goal is to have a small and cleaned up version of IRB. Trimmed down to only do the stuff I, and most people I know, actually use.

Trimming down the core code is done mainly by using Ripper, which comes with Ruby 1.9, instead of shipping it’s own parser etc.

There’s still lots to be done, but the ‘basic functionality’ as is now, should not grow too much more. For now my things to-do are .irbrc support, completion, and investigate what else people really really need. After that it’s time to polish.

Important notice

Since on Ruby 1.9 all latest gems are pushed onto the load path by default, installing the DietRB gem would break the existing IRB binary. Therefor, with the DietRB gem is installed, it will hijack the ‘irb’ bin file.

The original IRB will still work when you uninstall the DietRB gem, though.

Extensions

  • irb/ext/colorize.rb, adds support for colorizing the prompt and result. The code was based upon Wirble’s implementation, so your custom Wirble themes should still work.

    Configure it with:

    • IRB.formatter.color_scheme = scheme, where scheme can be: :dark_background, :light_background, or :fresh. Defaults to :dark_background.

    • IRB.formatter.colors returns the hash of current token-type to color mappings.

  • irb/ext/completion.rb, adds, as the name implies, autocompletion for constants, variables, methods, etc.

  • irb/ext/history.rb, stores/loads the history in and from the history file, which is located at ~/.irb_history.

    It provides the following API:

    • Kernel#history(N), or Kernel#h, will show N number of the most recent history entries. Defaults to 50.

    • Kernel#history!(entry_or_range), or Kernel#h!, will execute the specified history entry, or entries if a range is given.

    • Kernel#clear_history! will clear the history and the history file.

Differences

  • Dietrb will try to warn about syntax errors as soon as a line is entered and only reset the buffer to the previous line. This means that you don’t need to loose any previous work:

    IRB:

    irb(main):001:0> class A
    irb(main):002:1>   def foo
    irb(main):003:2>     } p :ok
    irb(main):004:1>   end
    SyntaxError: compile error
    (irb):3: syntax error, unexpected '}'
        } p :ok
         ^
    (irb):4: syntax error, unexpected $end, expecting kEND
    	from (irb):4
    	from :0
    irb(main):005:0> A.new.foo
    NameError: uninitialized constant A
    	from (irb):5
    	from :0

    Dietrb:

    irb(main):001:0> class A
    irb(main):002:1>   def foo
    irb(main):003:2>     } p :ok
    SyntaxError: compile error
    (irb):3: syntax error, unexpected '}'
    irb(main):004:2>     p :ok
    irb(main):005:2>   end
    irb(main):006:1> end
    => nil
    irb(main):007:0> A.new.foo
    :ok
    => :ok

Play

Normal usage:

irb(main):001:0> class A
irb(main):002:1>   def foo
irb(main):003:2>     :ok
irb(main):004:2>   end
irb(main):005:1> end
=> nil
irb(main):006:0> irb A.new
irb(#<#<Class:…>::A:…>):001:0> foo
=> :ok
irb(#<#<Class:…>::A:…>):002:0> quit
=> nil
irb(main):007:0> quit

About

IRB on a diet, for MacRuby / Ruby 1.9

rubygems.org/gems/dietrb

Resources

Readme
License
Activity
Custom properties

Stars

14 stars

Watchers

7 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.