@JRubyMethod(name = {"readable?", "readable_real?"}, required = 1, module = true) public static IRubyObject readable_p(ThreadContext context, IRubyObject recv, IRubyObject filename) { Ruby runtime = context.runtime; if (!(filename instanceof RubyFile)) { filename = get_path(context, filename); } return runtime.newBoolean(fileResource(filename).canRead()); }
@JRubyMethod(name = {"readable?", "readable_real?"}, required = 1, module = true) public static IRubyObject readable_p(ThreadContext context, IRubyObject recv, IRubyObject filename) { Ruby runtime = context.runtime; if (!(filename instanceof RubyFile)) { filename = get_path(context, filename); } return runtime.newBoolean(fileResource(filename).canRead()); }
@JRubyMethod(name = {"readable?", "readable_real?"}, required = 1, module = true) public static IRubyObject readable_p(ThreadContext context, IRubyObject recv, IRubyObject filename) { Ruby runtime = context.runtime; if (!(filename instanceof RubyFile)) { filename = get_path(context, filename); } FileResource file = fileResource(filename); return runtime.newBoolean(file.exists() && file.canRead()); }
private static String[] getEntries(ThreadContext context, FileResource dir, String path) { if (!dir.isDirectory()) { if (dir.exists()) { throw context.runtime.newErrnoENOTDIRError(path); } throw context.runtime.newErrnoENOENTError(path); } if (!dir.canRead()) throw context.runtime.newErrnoEACCESError(path); String[] list = dir.list(); return list == null ? NO_FILES : list; }
private static String[] getEntries(ThreadContext context, FileResource dir, String path) { if (!dir.isDirectory()) { if (dir.exists()) { throw context.runtime.newErrnoENOTDIRError(path); } throw context.runtime.newErrnoENOENTError(path); } if (!dir.canRead()) throw context.runtime.newErrnoEACCESError(path); String[] list = dir.list(); return list == null ? NO_FILES : list; }
FileResource resource = JRubyFile.createRestrictedResource(getCurrentDirectory(), getScriptFileName()); if (resource != null && resource.exists()) { if (resource.canRead() && !resource.isDirectory()) { if (isXFlag()) {
FileResource resource = JRubyFile.createRestrictedResource(getCurrentDirectory(), getScriptFileName()); if (resource != null && resource.exists()) { if (resource.canRead() && !resource.isDirectory()) { if (isXFlag()) {