When calling a script from irb/command line. You can use this snippet to take statements from stdin and evaluate them in the current context just like IRB. Use qq to stop.
if options[:debug]
STDOUT << ">> "
while (cmd=gets.chomp)!="qq"
puts eval(cmd).inspect
STDOUT << ">> "
end
end
No comments:
Post a Comment