stdlib/dev.rb in opal-0.3.10 vs stdlib/dev.rb in opal-0.3.11

- old
+ new

@@ -1,18 +1,20 @@ require 'opal/lexer' module Opal def self.compile(source) - res = Opal::Parser.new(source).parse!.generate_top :debug => true + res = Parser.new.parse source, :method_missing => true res end def self.run_ruby_content(source, filename = "(opal)") js = compile source - `var exec = new Function('$rb', 'self', '__FILE__', js); - return exec($rb, $rb.top, filename);` + `opal.run(new Function("(" + js + + ")(opal.runtime, opal.runtime.top, '')"));` + + nil end # Load the ruby code at the remote url, parse and run it. This is typically # used when loading a script tag of type text/ruby. The filename given in the # tag is used as the actual filename @@ -48,10 +50,10 @@ for (var i = 0, ii = scripts.length; i < ii; i++) { var script = scripts[i]; if (script.type == "text/ruby") { if (script.src) { - #{ run_remote_content `script.src` }; + #{ run_remote_content `script.getAttribute('src', 2)` }; } else { opal.run(function() { #{ run_ruby_content `script.innerHTML`, "(script-tag)" }; }); }