Skip to content

Instantly share code, notes, and snippets.

@arunjax
Created August 22, 2011 01:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arunjax/356e7dcc2ec93be4cb99 to your computer and use it in GitHub Desktop.
Save arunjax/356e7dcc2ec93be4cb99 to your computer and use it in GitHub Desktop.
Simple irb

IRB implemented in single line of ruby code:

$ ruby i.rb

> a = "Simple"

=> Simple

> b = "IRB"

=> IRB

> a + ' ' + b

=> Simple IRB

> IO.read($0)

=> until(puts(%Q[=> #{eval("#{print('> ')}#{gets.chomp}")}])) do end

> exit

$

No exception handling, no line navigation, no history, no multi-line support :-(

until(puts(%Q[=> #{eval("#{print('> ')}#{gets.chomp}")}])) do end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment