Skip to content

Instantly share code, notes, and snippets.

@song940
Created November 20, 2013 08:42
Show Gist options
  • Save song940/7559841 to your computer and use it in GitHub Desktop.
Save song940/7559841 to your computer and use it in GitHub Desktop.
simple irb
# simple irb
prompt = '[0] '
binding = Object.new.send :binding
loop do
print prompt
prompt.succ!
begin
res = binding.eval gets
rescue SystemExit
exit
rescue Exception
puts $!.message
puts $!.backtrace
end
puts "=> #{res.inspect}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment