public void load(Ruby runtime, boolean wrap) { try { IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getPath(), resource.getName(), resource.isAbsolute()); if (script == null) { // we're depending on the side effect of the load, which loads the class but does not turn it into a script // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. return; } script.setFileName(resource.getName()); runtime.loadScope(script, wrap); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } }
public void load(Ruby runtime, boolean wrap) { try { IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, resource.getInputStream(), resource.getPath(), resource.getName(), resource.isAbsolute()); if (script == null) { // we're depending on the side effect of the load, which loads the class but does not turn it into a script // I don't like it, but until we restructure the code a bit more, we'll need to quietly let it by here. return; } script.setFileName(resource.getName()); runtime.loadScope(script, wrap); } catch (IOException e) { throw runtime.newIOErrorFromException(e); } } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = normalizeSeps(resource.getName()); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { java.io.File path = resource.getPath(); if(path != null && !resource.isAbsolute()) { // Note: We use RubyFile's canonicalize rather than Java's, // because Java's will follow symlinks and result in __FILE__ // being set to the target of the symlink rather than the // filename provided. name = normalizeSeps(canonicalize(path.getPath())); } runtime.loadFile(name, in, wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = resource.getName(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute()); runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = normalizeSeps(resource.getName()); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { java.io.File path = resource.getPath(); if(path != null && !resource.isAbsolute()) { // Note: We use RubyFile's canonicalize rather than Java's, // because Java's will follow symlinks and result in __FILE__ // being set to the target of the symlink rather than the // filename provided. name = normalizeSeps(canonicalize(path.getPath())); } runtime.loadFile(name, in, wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }
public void load(Ruby runtime, boolean wrap) { InputStream in = null; try { in = resource.getInputStream(); String name = resource.getName(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(name, in, wrap); } else { name = CompiledScriptLoader.getFilenameFromPathAndName(resource.getPath(), name, resource.isAbsolute()); runtime.loadFile(name, new LoadServiceResourceInputStream(in), wrap); } } catch (IOException e) { throw runtime.newIOErrorFromException(e); } finally { try { in.close(); } catch (Exception ex) {} } }