org.jruby.RubyHash.op_aref()方法的使用及代码示例

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

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

RubyHash.op_aref介绍

[英]rb_hash_aref
[中]rb_hash_aref

代码示例

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

@Override
  protected IRubyObject innerCall(ThreadContext context, IRubyObject fallback, IRubyObject c) {
    return ((RubyHash)fallback).op_aref(context, c);
  }
};

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

@Override
  protected IRubyObject innerCall(ThreadContext context, IRubyObject fallback, IRubyObject c) {
    return ((RubyHash)fallback).op_aref(context, c);
  }
};

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

@JRubyMethod(name = "__map_symbol")
  public IRubyObject mapSymbol(final ThreadContext context, IRubyObject symbol){
    return symbolMap.op_aref(context, symbol);
  }
}

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

@JRubyMethod(name = "__map_symbol")
  public IRubyObject mapSymbol(final ThreadContext context, IRubyObject symbol){
    return symbolMap.op_aref(context, symbol);
  }
}

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

protected IRubyObject case_aware_op_aref(ThreadContext context, IRubyObject key, boolean caseSensitive) {
  if (! caseSensitive) {
    key = getCorrectKey(key, context);
  }
  return super.op_aref(context, key);
}

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

protected IRubyObject case_aware_op_aref(ThreadContext context, IRubyObject key, boolean caseSensitive) {
  if (! caseSensitive) {
    key = getCorrectKey(key, context);
  }
  return super.op_aref(context, key);
}

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

/**
 * Note: this is included as a compatibility measure for Mongrel+JRuby
 * @deprecated use RubyHash.op_aref instead
 */
public IRubyObject aref(IRubyObject key) {
  return op_aref(getRuntime().getCurrentContext(), key);
}

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

/**
 * Note: this is included as a compatibility measure for Mongrel+JRuby
 * @deprecated use RubyHash.op_aref instead
 */
public IRubyObject aref(IRubyObject key) {
  return op_aref(getRuntime().getCurrentContext(), key);
}

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

/**
 * Note: this is included as a compatibility measure for Mongrel+JRuby
 * @deprecated use RubyHash.op_aref instead
 */
public IRubyObject aref(IRubyObject key) {
  return op_aref(getRuntime().getCurrentContext(), key);
}

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

@JRubyMethod(name = "ruby", meta = true)
public static IRubyObject ruby(ThreadContext context, IRubyObject recv) {
  Ruby runtime = context.runtime;
  RubyHash configHash = (RubyHash) runtime.getModule("RbConfig").getConstant("CONFIG");
  IRubyObject bindir            = configHash.op_aref(context, runtime.newString("bindir"));
  IRubyObject ruby_install_name = configHash.op_aref(context, runtime.newString("ruby_install_name"));
  IRubyObject exeext            = configHash.op_aref(context, runtime.newString("EXEEXT"));
  return Helpers.invoke(context, runtime.getClass("File"), "join", bindir, ruby_install_name.callMethod(context, "+", exeext));
}

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

/** rb_hash_values_at
 *
 */
@JRubyMethod(name = "values_at", rest = true)
public RubyArray values_at(ThreadContext context, IRubyObject[] args) {
  RubyArray result = RubyArray.newBlankArrayInternal(context.runtime, args.length);
  for (int i = 0; i < args.length; i++) {
    result.store(i, op_aref(context, args[i]));
  }
  return result;
}

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

@JRubyMethod(name = "ruby", module = true, compat = CompatVersion.RUBY1_9)
public static IRubyObject ruby(ThreadContext context, IRubyObject recv) {
  Ruby runtime = context.runtime;
  RubyHash configHash = (RubyHash) runtime.getModule("RbConfig").getConstant("CONFIG");
  IRubyObject bindir            = configHash.op_aref(context, runtime.newString("bindir"));
  IRubyObject ruby_install_name = configHash.op_aref(context, runtime.newString("ruby_install_name"));
  IRubyObject exeext            = configHash.op_aref(context, runtime.newString("EXEEXT"));
  return Helpers.invoke(context, runtime.getClass("File"), "join", bindir, ruby_install_name.callMethod(context, "+", exeext));
}

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

/** rb_hash_values_at
 *
 */
@JRubyMethod(name = "values_at", rest = true)
public RubyArray values_at(ThreadContext context, IRubyObject[] args) {
  RubyArray result = RubyArray.newBlankArrayInternal(context.runtime, args.length);
  for (int i = 0; i < args.length; i++) {
    result.store(i, op_aref(context, args[i]));
  }
  return result;
}

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

public static RubyString getHomeDirectoryPath(ThreadContext context) {
  final RubyString homeKey = RubyString.newStringShared(context.runtime, HOME);
  return getHomeDirectoryPath(context, context.runtime.getENV().op_aref(context, homeKey));
}

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

/** rb_hash_values_at
 *
 */
@JRubyMethod(name = "values_at", rest = true)
public RubyArray values_at(ThreadContext context, IRubyObject[] args) {
  RubyArray result = RubyArray.newArray(getRuntime(), args.length);
  for (int i = 0; i < args.length; i++) {
    result.append(op_aref(context, args[i]));
  }
  return result;
}

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

/** rb_hash_values_at
 *
 */
@JRubyMethod(name = "values_at", rest = true)
public RubyArray values_at(ThreadContext context, IRubyObject[] args) {
  RubyArray result = RubyArray.newArray(getRuntime(), args.length);
  for (int i = 0; i < args.length; i++) {
    result.append(op_aref(context, args[i]));
  }
  return result;
}

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

private static IRubyObject getEnvTimeZone(Ruby runtime) {
  RubyString tzVar = runtime.newString(TZ_STRING);
  RubyHash h = ((RubyHash)runtime.getObject().getConstant("ENV"));
  IRubyObject tz = h.op_aref(runtime.getCurrentContext(), tzVar);
  return tz;
}

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

public static File findPathExecutable(Ruby runtime, String fname) {
  RubyHash env = (RubyHash) runtime.getObject().getConstant("ENV");
  IRubyObject pathObject = env.op_aref(runtime.getCurrentContext(), RubyString.newString(runtime, PATH_ENV));
  return findPathExecutable(runtime, fname, pathObject);
}

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

@JIT
public static IRubyObject callOptimizedAref(ThreadContext context, IRubyObject caller, IRubyObject target, RubyString keyStr, CallSite site) {
  if (target instanceof RubyHash && ((CachingCallSite) site).isBuiltin(target.getMetaClass())) {
    // call directly with cached frozen string
    return ((RubyHash) target).op_aref(context, keyStr);
  }
  return site.call(context, caller, target, keyStr.strDup(context.runtime));
}

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

@JIT
public static IRubyObject callOptimizedAref(ThreadContext context, IRubyObject caller, IRubyObject target, RubyString keyStr, CallSite site) {
  if (target instanceof RubyHash && ((CachingCallSite) site).isBuiltin(target.getMetaClass())) {
    // call directly with cached frozen string
    return ((RubyHash) target).op_aref(context, keyStr);
  }
  return site.call(context, caller, target, keyStr.strDup(context.runtime));
}

相关文章

微信公众号

最新文章

更多

RubyHash类方法