code/superant.com.rwdshell/rubyeval.rb in rwdruby-1.05 vs code/superant.com.rwdshell/rubyeval.rb in rwdruby-1.06

- old
+ new

@@ -1,28 +1,23 @@ - $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 - + commandtextruby = "%s " % [@a_rubyeval] - + + begin # begin rescue monitored block + if commandtextruby.include? '´' + @rubydisplay = "\n" + "problem in eval" + else + @rubydisplay = eval( commandtextruby ).to_s + end - rescue # process exeption - # $stdout = $tmpout # restore STDOUT to normal - @rubydisplay = "\n" + "error in eval" - end # end of rescue process # of rescure monitored block - + rescue # process exeption - end +@rubydisplay = "\n" + "error in eval" + + end # end of rescue process # of rescure monitored block + end