Created
July 23, 2009 11:28
-
-
Save cldwalker/152773 to your computer and use it in GitHub Desktop.
mini-irb
This file contains 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
%w{readline rubygems bond}.each {|e| require e } | |
Bond.start | |
history_file = File.join(ENV["HOME"], '.mini_irb_history') | |
IO.readlines(history_file).each {|e| Readline::HISTORY << e.chomp } if File.exists?(history_file) | |
while (input = Readline.readline('>> ', true)) != 'exit' | |
begin puts "=> #{eval(input).inspect}"; rescue Exception; puts "Error: #{$!}" end | |
end | |
File.open(history_file, 'w') {|f| f.write Readline::HISTORY.to_a.join("\n") } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment