I’m trying to execute the following lines:
ScriptContext sct = jruby.getContext();
jruby.eval(“sheet = Spreadsheet.new”, sct);
jruby.eval(“sheet.cells.a1 = ‘Welcome’”, sct);
The first two lines are executed correctly, but the last one gives the
undefined local variable or method `sheet’ for main:Object
it indicates that sheet is undefined although it’s defined in line 2.
When I try to execute both commands in a single statement like:
jruby.eval(“sheet = Spreadsheet.new \n sheet.cells.a1 = ‘Welcome’”,
The statement is executed correctly.