diff --git a/js/johnson/prelude.js b/js/johnson/prelude.js index 6489427..f2be8d1 100644 --- a/js/johnson/prelude.js +++ b/js/johnson/prelude.js @@ -51,7 +51,7 @@ Johnson.require = function(file) { if(Ruby.File.send("file?", path)) { Johnson.required[file] = true; - eval(Ruby.File.read(path)); + Johnson.currentContext.load(path); return true; } diff --git a/lib/johnson/context.rb b/lib/johnson/context.rb index 12ae214..4326be8 100644 --- a/lib/johnson/context.rb +++ b/lib/johnson/context.rb @@ -4,7 +4,8 @@ class Context def initialize(delegate=Johnson::SpiderMonkey::Context) @delegate = delegate.is_a?(Class) ? delegate.new : delegate - evaluate(Johnson::PRELUDE, 'Johnson::PRELUDE') + evaluate(Johnson::PRELUDE, "Johnson::PRELUDE", 1) + global.Johnson.currentContext = self end def [](key) @@ -25,7 +26,7 @@ def global end def load(file) - delegate.evaluate(IO.read(file), file) + delegate.evaluate(IO.read(file), file, 1) end end end