-
-
Save lsongdev/7559841 to your computer and use it in GitHub Desktop.
simple irb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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