Hi,

At Sat, 7 Dec 2002 10:11:51 +0900,
Chris Pine wrote:
>   def executeCode (code, input)  #  I'm just ignoring input for now.
>     code = "begin\n" +
>             code +
>            "\nrescue Exception => error\n" +
>            "puts error.inspect\n" +
>            "end\n"
>     strIO = StringIO.new
      if input
        input = StringIO.new(input, "r")
        class << strIO; self; end.class_eval do
          %w[gets getc read].each do |f|
            define_method(f, &input.method(f))
          end
        end
      end
>     strIO.instance_eval code
>     strIO.string
>   end

-- 
Nobu Nakada