org.jruby.RubyModule.getAutoloadFile()方法的使用及代码示例

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

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

RubyModule.getAutoloadFile介绍

暂无

代码示例

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

@JRubyMethod(name = "autoload?", required = 1, module = true, visibility = PRIVATE)
public static IRubyObject autoload_p(ThreadContext context, final IRubyObject recv, IRubyObject symbol) {
  final Ruby runtime = context.runtime;
  final RubyModule module = getModuleForAutoload(runtime, recv);
  final RubyString file = module.getAutoloadFile(symbol.asJavaString());
  return file == null ? context.nil : file;
}

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

@JRubyMethod(name = "autoload?", required = 1, module = true, visibility = PRIVATE)
public static IRubyObject autoload_p(ThreadContext context, final IRubyObject recv, IRubyObject symbol) {
  final Ruby runtime = context.runtime;
  final RubyModule module = getModuleForAutoload(runtime, recv);
  final RubyString file = module.getAutoloadFile(symbol.asJavaString());
  return file == null ? context.nil : file;
}

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

@JRubyMethod(name = "autoload?", required = 1, module = true, visibility = PRIVATE)
public static IRubyObject autoload_p(ThreadContext context, final IRubyObject recv, IRubyObject symbol) {
  Ruby runtime = context.runtime;
  final RubyModule module = getModuleForAutoload(runtime, recv);
  String name = symbol.asJavaString();
  
  String file = module.getAutoloadFile(name);
  return (file == null) ? runtime.getNil() : runtime.newString(file);
}

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

@JRubyMethod(name = "autoload?", required = 1, module = true, visibility = PRIVATE)
public static IRubyObject autoload_p(ThreadContext context, final IRubyObject recv, IRubyObject symbol) {
  Ruby runtime = context.runtime;
  final RubyModule module = getModuleForAutoload(runtime, recv);
  String name = symbol.asJavaString();
  
  String file = module.getAutoloadFile(name);
  return (file == null) ? runtime.getNil() : runtime.newString(file);
}

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

@JRubyMethod(name = "autoload?")
  public static IRubyObject autoload_p(ThreadContext context, IRubyObject self, IRubyObject symbol) {
    final Ruby runtime = context.runtime;
    final String name = TypeConverter.checkID(symbol).idString();
    RubyModule mod = RubyKernel.getModuleForAutoload(runtime, self);
    for (/* RubyModule mod = (RubyModule) self */; mod != null; mod = mod.getSuperClass()) {
      final IRubyObject loadedValue = mod.fetchConstant(name);
      if ( loadedValue != null && loadedValue != UNDEF ) return context.nil;
      final RubyString file;
      if ( mod.isIncluded() ) {
        file = mod.getNonIncludedClass().getAutoloadFile(name);
      }
      else {
        file = mod.getAutoloadFile(name);
      }
      if ( file != null ) { // due explicit requires still need to :
        if ( runtime.getLoadService().featureAlreadyLoaded(file.asJavaString()) ) {
          // TODO in which case the auto-load never finish-es ?!
          return context.nil;
        }
        return file;
      }
    }
    return context.nil;
  }
}

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

@JRubyMethod(name = "autoload?")
  public static IRubyObject autoload_p(ThreadContext context, IRubyObject self, IRubyObject symbol) {
    final Ruby runtime = context.runtime;
    final String name = TypeConverter.checkID(symbol).idString();
    RubyModule mod = RubyKernel.getModuleForAutoload(runtime, self);
    for (/* RubyModule mod = (RubyModule) self */; mod != null; mod = mod.getSuperClass()) {
      final IRubyObject loadedValue = mod.fetchConstant(name);
      if ( loadedValue != null && loadedValue != UNDEF ) return context.nil;
      final RubyString file;
      if ( mod.isIncluded() ) {
        file = mod.getNonIncludedClass().getAutoloadFile(name);
      }
      else {
        file = mod.getAutoloadFile(name);
      }
      if ( file != null ) { // due explicit requires still need to :
        if ( runtime.getLoadService().featureAlreadyLoaded(file.asJavaString()) ) {
          // TODO in which case the auto-load never finish-es ?!
          return context.nil;
        }
        return file;
      }
    }
    return context.nil;
  }
}

相关文章

微信公众号

最新文章

更多

RubyModule类方法