$buffer = '' def $buffer.write(str) # create a variable to use in rubyeval self << str end def rubyeval require 'English' # $tmpout = $stdout # save the original STDOUT # $stdout = $buffer begin # begin rescue monitored block commandtextruby = "%s " % [@a_rubyeval] # @rubydisplay = "hello" @rubydisplay = eval( commandtextruby ).to_s rescue # process exeption # $stdout = $tmpout # restore STDOUT to normal @rubydisplay = "\n" + "error in eval" end # end of rescue process # of rescure monitored block end