Object
# File lib/commonjs/environment.rb, line 23 def native(module_id, impl) @modules[module_id] = Module::Native.new(impl) end
# File lib/commonjs/environment.rb, line 27 def new_object @runtime['Object'].new end
# File lib/commonjs/environment.rb, line 13 def require(module_id) unless mod = @modules[module_id] filepath = find(module_id) or fail LoadError, "no such module '#{module_id}'" load = @runtime.eval("(function(module, require, exports) {#{File.read(filepath)}})", filepath.expand_path.to_s) @modules[module_id] = mod = Module.new(module_id, self) load.call(mod, mod.require_function, mod.exports) end return mod.exports end
Generated with the Darkfish Rdoc Generator 2.