org.jruby.Ruby.getFileTest()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(8.9k)|赞(0)|评价(0)|浏览(112)

本文整理了Java中org.jruby.Ruby.getFileTest方法的一些代码示例,展示了Ruby.getFileTest的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getFileTest方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getFileTest

Ruby.getFileTest介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "empty?")
public IRubyObject empty_p(ThreadContext context) {
  RubyModule fileTest = context.runtime.getFileTest();
  if (fileTest.callMethod(context, "directory?", getPath()).isTrue()) {
    return context.runtime.getDir().callMethod(context, "empty?", getPath());
  } else {
    return fileTest.callMethod(context, "empty?", getPath());
  }
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "empty?")
public IRubyObject empty_p(ThreadContext context) {
  RubyModule fileTest = context.runtime.getFileTest();
  if (fileTest.callMethod(context, "directory?", getPath()).isTrue()) {
    return context.runtime.getDir().callMethod(context, "empty?", getPath());
  } else {
    return fileTest.callMethod(context, "empty?", getPath());
  }
}

代码示例来源:origin: org.jruby/jruby-core

static void createPathnameClass(Ruby runtime) {
  RubyClass cPathname = runtime.defineClass("Pathname", runtime.getObject(),
      PATHNAME_ALLOCATOR);
  cPathname.defineAnnotatedMethods(RubyPathname.class);
  runtime.getKernel().defineAnnotatedMethods(PathnameKernelMethods.class);
  // FIXME: birthtime is provided separately in stat on some platforms (#2152)
  defineDelegateMethods(cPathname, runtime.getFile(), "atime", "ctime", "birthtime", "mtime", "ftype",
      "rename", "stat", "lstat", "truncate", "extname", "open");
  defineDelegateMethodsAppendPath(cPathname, runtime.getFile(), "chmod", "lchmod", "chown",
      "lchown", "utime");
  defineDelegateMethodsSinglePath(cPathname, runtime.getFile(), "realpath", "realdirpath",
      "basename", "dirname", "expand_path", "readlink");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getFile(), "split");
  defineDelegateMethods(cPathname, runtime.getIO(), "read", "binread", "write", "binwrite",
      "readlines", "sysopen");
  defineDelegateMethods(cPathname, runtime.getFileTest(), "blockdev?", "chardev?",
      "executable?", "executable_real?", "exist?", "grpowned?", "directory?", "file?",
      "pipe?", "socket?", "owned?", "readable?", "world_readable?", "readable_real?",
      "setuid?", "setgid?", "size", "size?", "sticky?", "symlink?", "writable?",
      "world_writable?", "writable_real?", "zero?");
  defineDelegateMethods(cPathname, runtime.getDir(), "mkdir", "rmdir");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getDir(), "entries");
  cPathname.undefineMethod("=~");
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

static void createPathnameClass(Ruby runtime) {
  RubyClass cPathname = runtime.defineClass("Pathname", runtime.getObject(),
      PATHNAME_ALLOCATOR);
  cPathname.defineAnnotatedMethods(RubyPathname.class);
  runtime.getKernel().defineAnnotatedMethods(PathnameKernelMethods.class);
  defineDelegateMethods(cPathname, runtime.getFile(), "atime", "ctime", "mtime", "ftype",
      "rename", "stat", "lstat", "truncate", "extname", "open");
  defineDelegateMethodsAppendPath(cPathname, runtime.getFile(), "chmod", "lchmod", "chown",
      "lchown", "utime");
  defineDelegateMethodsSinglePath(cPathname, runtime.getFile(), "realpath", "realdirpath",
      "basename", "dirname", "expand_path", "readlink");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getFile(), "split");
  defineDelegateMethods(cPathname, runtime.getIO(), "read", "binread", "write", "binwrite",
      "readlines", "sysopen");
  defineDelegateMethods(cPathname, runtime.getFileTest(), "blockdev?", "chardev?",
      "executable?", "executable_real?", "exist?", "grpowned?", "directory?", "file?",
      "pipe?", "socket?", "owned?", "readable?", "world_readable?", "readable_real?",
      "setuid?", "setgid?", "size", "size?", "sticky?", "symlink?", "writable?",
      "world_writable?", "writable_real?", "zero?");
  defineDelegateMethods(cPathname, runtime.getDir(), "mkdir", "rmdir");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getDir(), "entries");
  cPathname.undefineMethod("=~");
}

代码示例来源:origin: org.jruby/jruby-complete

static void createPathnameClass(Ruby runtime) {
  RubyClass cPathname = runtime.defineClass("Pathname", runtime.getObject(),
      PATHNAME_ALLOCATOR);
  cPathname.defineAnnotatedMethods(RubyPathname.class);
  runtime.getKernel().defineAnnotatedMethods(PathnameKernelMethods.class);
  // FIXME: birthtime is provided separately in stat on some platforms (#2152)
  defineDelegateMethods(cPathname, runtime.getFile(), "atime", "ctime", "birthtime", "mtime", "ftype",
      "rename", "stat", "lstat", "truncate", "extname", "open");
  defineDelegateMethodsAppendPath(cPathname, runtime.getFile(), "chmod", "lchmod", "chown",
      "lchown", "utime");
  defineDelegateMethodsSinglePath(cPathname, runtime.getFile(), "realpath", "realdirpath",
      "basename", "dirname", "expand_path", "readlink");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getFile(), "split");
  defineDelegateMethods(cPathname, runtime.getIO(), "read", "binread", "write", "binwrite",
      "readlines", "sysopen");
  defineDelegateMethods(cPathname, runtime.getFileTest(), "blockdev?", "chardev?",
      "executable?", "executable_real?", "exist?", "grpowned?", "directory?", "file?",
      "pipe?", "socket?", "owned?", "readable?", "world_readable?", "readable_real?",
      "setuid?", "setgid?", "size", "size?", "sticky?", "symlink?", "writable?",
      "world_writable?", "writable_real?", "zero?");
  defineDelegateMethods(cPathname, runtime.getDir(), "mkdir", "rmdir");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getDir(), "entries");
  cPathname.undefineMethod("=~");
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

static void createPathnameClass(Ruby runtime) {
  RubyClass cPathname = runtime.defineClass("Pathname", runtime.getObject(),
      PATHNAME_ALLOCATOR);
  cPathname.defineAnnotatedMethods(RubyPathname.class);
  runtime.getKernel().defineAnnotatedMethods(PathnameKernelMethods.class);
  defineDelegateMethods(cPathname, runtime.getFile(), "atime", "ctime", "mtime", "ftype",
      "rename", "stat", "lstat", "truncate", "extname", "open");
  defineDelegateMethodsAppendPath(cPathname, runtime.getFile(), "chmod", "lchmod", "chown",
      "lchown", "utime");
  defineDelegateMethodsSinglePath(cPathname, runtime.getFile(), "realpath", "realdirpath",
      "basename", "dirname", "expand_path", "readlink");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getFile(), "split");
  defineDelegateMethods(cPathname, runtime.getIO(), "read", "binread", "write", "binwrite",
      "readlines", "sysopen");
  defineDelegateMethods(cPathname, runtime.getFileTest(), "blockdev?", "chardev?",
      "executable?", "executable_real?", "exist?", "grpowned?", "directory?", "file?",
      "pipe?", "socket?", "owned?", "readable?", "world_readable?", "readable_real?",
      "setuid?", "setgid?", "size", "size?", "sticky?", "symlink?", "writable?",
      "world_writable?", "writable_real?", "zero?");
  defineDelegateMethods(cPathname, runtime.getDir(), "mkdir", "rmdir");
  defineDelegateMethodsArrayOfPaths(cPathname, runtime.getDir(), "entries");
  cPathname.undefineMethod("=~");
}

相关文章

Ruby类方法