本文整理了Java中org.jruby.Ruby.getDir
方法的一些代码示例,展示了Ruby.getDir
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getDir
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getDir
暂无
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject opendir(ThreadContext context, Block block) {
return context.runtime.getDir().callMethod(context, "open", new IRubyObject[] { path },
block);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject opendir(ThreadContext context, Block block) {
return context.runtime.getDir().callMethod(context, "open", new IRubyObject[] { path },
block);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject opendir(ThreadContext context, Block block) {
return context.runtime.getDir().callMethod(context, "open", new IRubyObject[] { getPath()},
block);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject opendir(ThreadContext context, Block block) {
return context.runtime.getDir().callMethod(context, "open", new IRubyObject[] { getPath()},
block);
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod(alias = "pwd", meta = true)
public static IRubyObject getwd(ThreadContext context, IRubyObject recv) {
return newInstance(context, context.runtime.getDir().callMethod("getwd"));
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod(required = 1, optional = 1, meta = true)
public static IRubyObject glob(ThreadContext context, IRubyObject recv, IRubyObject[] args,
Block block) {
// TODO: yield block while iterating
RubyArray files = mapToPathnames(context, (RubyClass) recv,
context.runtime.getDir().callMethod(context, "glob", args));
if (block.isGiven()) {
files.each(context, block);
return context.nil;
} else {
return files;
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
private static IRubyObject foreachCommon(ThreadContext context, IRubyObject recv, Ruby runtime, RubyString _path, Block block) {
if (block.isGiven()) {
RubyClass dirClass = runtime.getDir();
RubyDir dir = (RubyDir) dirClass.newInstance(context, new IRubyObject[]{_path}, block);
dir.each(context, block);
return runtime.getNil();
}
return enumeratorize(runtime, recv, "foreach", _path);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
private static IRubyObject foreachCommon(ThreadContext context, IRubyObject recv, Ruby runtime, RubyString _path, Block block) {
if (block.isGiven()) {
RubyClass dirClass = runtime.getDir();
RubyDir dir = (RubyDir) dirClass.newInstance(context, new IRubyObject[]{_path}, block);
dir.each(context, block);
return runtime.getNil();
}
return enumeratorize(runtime, recv, "foreach", _path);
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject each_entry(ThreadContext context, Block block) {
if (block.isGiven()) {
// TODO: yield block while iterating
RubyArray entries = callMethod(context, "entries").convertToArray();
entries.each(context, block);
return context.nil;
} else {
return context.runtime.getDir().callMethod(context, "foreach");
}
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject each_entry(ThreadContext context, Block block) {
if (block.isGiven()) {
// TODO: yield block while iterating
RubyArray entries = callMethod(context, "entries").convertToArray();
entries.each(context, block);
return context.nil;
} else {
return context.runtime.getDir().callMethod(context, "foreach");
}
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject each_entry(ThreadContext context, Block block) {
if (block.isGiven()) {
// TODO: yield block while iterating
RubyArray entries = callMethod(context, "entries").convertToArray();
entries.each(context, block);
return context.nil;
} else {
return context.runtime.getDir().callMethod(context, "foreach");
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod
public IRubyObject each_entry(ThreadContext context, Block block) {
if (block.isGiven()) {
// TODO: yield block while iterating
RubyArray entries = callMethod(context, "entries").convertToArray();
entries.each(context, block);
return context.nil;
} else {
return context.runtime.getDir().callMethod(context, "foreach");
}
}
代码示例来源:origin: org.jruby/jruby-complete
private static IRubyObject eachChildCommon(ThreadContext context, IRubyObject recv, RubyString path, RubyEncoding encoding, Block block) {
final Ruby runtime = context.runtime;
if (block.isGiven()) {
RubyDir dir = (RubyDir) runtime.getDir().newInstance(context, path, Block.NULL_BLOCK);
dir.each_child(context, encoding == null ? runtime.getDefaultEncoding() : encoding.getEncoding(), block);
return context.nil;
}
if (encoding == null) {
return enumeratorize(runtime, recv, "each_child", path);
}
return enumeratorize(runtime, recv, "each_child", path, encoding);
}
代码示例来源:origin: org.jruby/jruby-complete
private static IRubyObject foreachCommon(ThreadContext context, IRubyObject recv, RubyString path, RubyEncoding encoding, Block block) {
final Ruby runtime = context.runtime;
if (block.isGiven()) {
RubyDir dir = (RubyDir) runtime.getDir().newInstance(context, path, Block.NULL_BLOCK);
dir.each(context, encoding == null ? runtime.getDefaultEncoding() : encoding.getEncoding(), block);
return context.nil;
}
if (encoding == null) {
return enumeratorize(runtime, recv, "foreach", path);
}
return enumeratorize(runtime, recv, "foreach", path, encoding);
}
代码示例来源:origin: org.jruby/jruby-core
private static IRubyObject eachChildCommon(ThreadContext context, IRubyObject recv, RubyString path, RubyEncoding encoding, Block block) {
final Ruby runtime = context.runtime;
if (block.isGiven()) {
RubyDir dir = (RubyDir) runtime.getDir().newInstance(context, path, Block.NULL_BLOCK);
dir.each_child(context, encoding == null ? runtime.getDefaultEncoding() : encoding.getEncoding(), block);
return context.nil;
}
if (encoding == null) {
return enumeratorize(runtime, recv, "each_child", path);
}
return enumeratorize(runtime, recv, "each_child", path, encoding);
}
代码示例来源:origin: org.jruby/jruby-core
private static IRubyObject foreachCommon(ThreadContext context, IRubyObject recv, RubyString path, RubyEncoding encoding, Block block) {
final Ruby runtime = context.runtime;
if (block.isGiven()) {
RubyDir dir = (RubyDir) runtime.getDir().newInstance(context, path, Block.NULL_BLOCK);
dir.each(context, encoding == null ? runtime.getDefaultEncoding() : encoding.getEncoding(), block);
return context.nil;
}
if (encoding == null) {
return enumeratorize(runtime, recv, "foreach", path);
}
return enumeratorize(runtime, recv, "foreach", path, encoding);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@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);
}
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@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);
}
}
代码示例来源: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());
}
}
内容来源于网络,如有侵权,请联系作者删除!