stdlib/opal-parser.rb in opal-0.9.4 vs stdlib/opal-parser.rb in opal-0.10.0.beta1

- old
+ new

@@ -2,11 +2,16 @@ require 'opal/erb' require 'opal/version' module Kernel def eval(str) - code = Opal.compile str, file: '(eval)' - `eval(#{code})` + str = Opal.coerce_to!(str, String, :to_str) + code = Opal.compile str, file: '(eval)', eval: true + %x{ + return (function(self) { + return eval(#{code}); + })(self) + } end def require_remote url %x{ var r = new XMLHttpRequest();