@Override public void load(Ruby runtime, boolean wrap) { InputStream is = null; try { is = new BufferedInputStream(resource.inputStream(), 32768); IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, is, null, scriptName, false); // 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. if (script == null) return; script.setFileName(scriptName); runtime.loadScope(script, wrap); } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (is != null) is.close(); } catch (IOException ioE) { /* At least we tried.... */ } } } }
@Override public void load(Ruby runtime, boolean wrap) { InputStream is = null; try { is = new BufferedInputStream(resource.inputStream(), 32768); IRScope script = CompiledScriptLoader.loadScriptFromFile(runtime, is, null, scriptName, false); // 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. if (script == null) return; script.setFileName(scriptName); runtime.loadScope(script, wrap); } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (is != null) is.close(); } catch (IOException ioE) { /* At least we tried.... */ } } } }
@Override public void load(Ruby runtime, boolean wrap) { InputStream ris = null; try { ris = resource.inputStream(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(scriptName, ris, wrap); } else { runtime.loadFile(scriptName, new LoadServiceResourceInputStream(ris), wrap); } } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (ris != null) ris.close(); } catch (IOException ioE) { /* At least we tried.... */} } } }
@Override public void load(Ruby runtime, boolean wrap) { InputStream ris = null; try { ris = resource.inputStream(); if (runtime.getInstanceConfig().getCompileMode().shouldPrecompileAll()) { runtime.compileAndLoadFile(scriptName, ris, wrap); } else { runtime.loadFile(scriptName, new LoadServiceResourceInputStream(ris), wrap); } } catch(IOException e) { throw runtime.newLoadError("no such file to load -- " + searchName, searchName); } finally { try { if (ris != null) ris.close(); } catch (IOException ioE) { /* At least we tried.... */} } } }