@JRubyMethod public IRubyObject make_link(ThreadContext context, IRubyObject old) { IRubyObject[] args = new IRubyObject[] { old, path }; return context.runtime.getFile().callMethod(context, "link", args); }
@JRubyMethod public IRubyObject make_symlink(ThreadContext context, IRubyObject old) { IRubyObject[] args = new IRubyObject[] { old, path }; return context.runtime.getFile().callMethod(context, "symlink", args); }
@JRubyMethod public IRubyObject make_link(ThreadContext context, IRubyObject old) { IRubyObject[] args = new IRubyObject[] { old, path }; return context.runtime.getFile().callMethod(context, "link", args); }
public static RubyClass createTempfileClass(Ruby runtime) { RubyClass tempfileClass = runtime.defineClass("Tempfile", runtime.getFile(), TEMPFILE_ALLOCATOR); tempfileClass.defineAnnotatedMethods(Tempfile.class); return tempfileClass; }
@JRubyMethod public IRubyObject make_link(ThreadContext context, IRubyObject old) { IRubyObject[] args = new IRubyObject[] { old, getPath()}; return context.runtime.getFile().callMethod(context, "link", args); }
@JRubyMethod(alias = "fnmatch?", required = 1, optional = 1) public IRubyObject fnmatch(ThreadContext context, IRubyObject[] args) { args = insertPath(args, 1); return context.runtime.getFile().callMethod(context, "fnmatch?", args); }
@JRubyMethod(alias = "fnmatch?", required = 1, optional = 1) public IRubyObject fnmatch(ThreadContext context, IRubyObject[] args) { args = insertPath(args, 1); return context.runtime.getFile().callMethod(context, "fnmatch?", args); }
@JRubyMethod public IRubyObject make_symlink(ThreadContext context, IRubyObject old) { IRubyObject[] args = new IRubyObject[] { old, getPath()}; return context.runtime.getFile().callMethod(context, "symlink", args); }
@JRubyMethod public IRubyObject make_symlink(ThreadContext context, IRubyObject old) { IRubyObject[] args = new IRubyObject[] { old, getPath()}; return context.runtime.getFile().callMethod(context, "symlink", args); }
private static RubyString doJoin(ThreadContext context, IRubyObject recv, IRubyObject[] args) { final Ruby runtime = context.runtime; final String separator = runtime.getFile().getConstant("SEPARATOR").toString(); final RubyArray argsAry = RubyArray.newArrayMayCopy(runtime, args); final StringBuilder buffer = new StringBuilder(24); boolean isTainted = joinImpl(buffer, separator, context, recv, argsAry); RubyString fixedStr = new RubyString(runtime, runtime.getString(), buffer); fixedStr.setTaint(isTainted); return fixedStr; }
@JRubyMethod public IRubyObject sub_ext(ThreadContext context, IRubyObject newExt) { IRubyObject ext = context.runtime.getFile().callMethod(context, "extname", path); IRubyObject newPath = path.chomp(context, ext).callMethod(context, "+", newExt); return newInstance(context, newPath); }
@JRubyMethod(name = "open", required = 1, optional = 1, meta = true) public static IRubyObject open19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Ruby runtime = recv.getRuntime(); args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("rb")); JZlibRubyGzipReader gzio = newInstance(recv, args); return RubyGzipFile.wrapBlock(context, gzio, block); }
@JRubyMethod(name = "open", required = 1, optional = 1, meta = true, compat = RUBY1_9) public static IRubyObject open19(final ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Ruby runtime = recv.getRuntime(); args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("rb")); JZlibRubyGzipReader gzio = newInstance(recv, args, block); return RubyGzipFile.wrapBlock(context, gzio, block); }
@JRubyMethod(name = "open", required = 1, optional = 3, meta = true) public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Ruby runtime = recv.getRuntime(); args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("wb")); JZlibRubyGzipWriter gzio = newInstance(recv, args); return RubyGzipFile.wrapBlock(context, gzio, block); }
@JRubyMethod(name = "open", required = 1, optional = 2, meta = true, compat = RUBY1_8) public static IRubyObject open18(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Ruby runtime = recv.getRuntime(); args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("wb")); JZlibRubyGzipWriter gzio = newInstance(recv, args, block); return RubyGzipFile.wrapBlock(context, gzio, block); }
@JRubyMethod(name = "open", required = 1, optional = 3, meta = true) public static IRubyObject open19(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block block) { Ruby runtime = recv.getRuntime(); args[0] = Helpers.invoke(context, runtime.getFile(), "open", args[0], runtime.newString("wb")); JZlibRubyGzipWriter gzio = newInstance(recv, args); return RubyGzipFile.wrapBlock(context, gzio, block); }
public static RubyClass createFileStatClass(Ruby runtime) { // TODO: NOT_ALLOCATABLE_ALLOCATOR is probably ok here. Confirm. JRUBY-415 final RubyClass fileStatClass = runtime.getFile().defineClassUnder("Stat",runtime.getObject(), ALLOCATOR); runtime.setFileStat(fileStatClass); fileStatClass.includeModule(runtime.getModule("Comparable")); fileStatClass.defineAnnotatedMethods(RubyFileStat.class); return fileStatClass; }
@JRubyMethod public IRubyObject sub_ext(ThreadContext context, IRubyObject newExt) { IRubyObject ext = context.runtime.getFile().callMethod(context, "extname", getPath()); IRubyObject newPath = getPath().chomp(context, ext).callMethod(context, "+", newExt); return newInstance(context, newPath); }
@JRubyMethod public IRubyObject sub_ext(ThreadContext context, IRubyObject newExt) { IRubyObject ext = context.runtime.getFile().callMethod(context, "extname", getPath()); IRubyObject newPath = getPath().chomp(context, ext).callMethod(context, "+", newExt); return newInstance(context, newPath); }
@JRubyMethod(name = {"unlink", "delete"}) public IRubyObject unlink(ThreadContext context) { try { return context.runtime.getDir().callMethod(context, "unlink", path); } catch (RaiseException ex) { if (!context.runtime.getErrno().getClass("ENOTDIR").isInstance(ex.getException())) { throw ex; } return context.runtime.getFile().callMethod(context, "unlink", path); } }