Skip to content

Instantly share code, notes, and snippets.

@blacktm
Created January 20, 2013 16:16
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 blacktm/4579574 to your computer and use it in GitHub Desktop.
Save blacktm/4579574 to your computer and use it in GitHub Desktop.
An IRB implementation in Ruby.
require 'readline'
first_run = true
loop do
if first_run
puts
puts "Type a command to get started."
puts "Type \"exit\" to quit."
first_run = false
else
str = Readline.readline(">> ", true)
if str == "exit" then exit end
begin
puts eval str, TOPLEVEL_BINDING
rescue Exception => e
puts e
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment