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

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

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

RubyHash.dup介绍

[英]A lightweight dup for internal use that does not dispatch to initialize_copy nor rehash the keys. Intended for use in dup'ing keyword args for processing.
[中]一种内部使用的轻量级dup,不发送以初始化、复制或重新缓存密钥。用于复制关键字参数以进行处理。

代码示例

代码示例来源:origin: org.asciidoctor/asciidoctorj

/**
   * Invoked by JRuby when the map should be copied.
   * @return
   */
  public Object dup() {
    return new RubyHashMapDecorator((RubyHash) rubyHash.dup());
  }
}

代码示例来源:origin: asciidoctor/asciidoctorj

/**
   * Invoked by JRuby when the map should be copied.
   * @return
   */
  public Object dup() {
    return new RubyHashMapDecorator((RubyHash) rubyHash.dup());
  }
}

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

@JRubyMethod(name = { "symbol_map", "to_h", "to_hash" })
public final IRubyObject symbol_map(ThreadContext context) {
  return kv_map.dup(context);
}

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

/** rb_hash_reject
 *
 */
public RubyHash rejectInternal(ThreadContext context, Block block) {
  return ((RubyHash)dup()).delete_ifInternal(context, block);
}

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

/** rb_hash_reject
 *
 */
public RubyHash rejectInternal(ThreadContext context, Block block) {
  return ((RubyHash)dup()).delete_ifInternal(context, block);
}

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

@JRubyMethod(name = { "symbol_map", "to_h", "to_hash" })
public final IRubyObject symbol_map(ThreadContext context) {
  return kv_map.dup(context);
}

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

@JRubyMethod(name = { "symbol_map", "to_h", "to_hash" })
public final IRubyObject symbol_map(ThreadContext context) {
  return kv_map.dup(context);
}

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

@JRubyMethod(name = { "symbol_map", "to_h", "to_hash" })
public final IRubyObject symbol_map(ThreadContext context) {
  return kv_map.dup(context);
}

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

@JRubyMethod(name = "compact")
public IRubyObject compact(ThreadContext context) {
 IRubyObject res = dup();
 ((RubyHash)res).compact_bang(context);
 return res;
}

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

/** rb_hash_merge
 *
 */
@JRubyMethod
public RubyHash merge(ThreadContext context, IRubyObject other, Block block) {
  return ((RubyHash)dup()).merge_bang(context, other, block);
}

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

@JRubyMethod(name = "compact")
public IRubyObject compact(ThreadContext context) {
 IRubyObject res = dup();
 ((RubyHash)res).compact_bang(context);
 return res;
}

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

/** rb_hash_merge
 *
 */
@JRubyMethod
public RubyHash merge(ThreadContext context, IRubyObject other, Block block) {
  return ((RubyHash)dup()).merge_bang(context, other, block);
}

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

/** rb_hash_merge
 *
 */
@JRubyMethod
public RubyHash merge(ThreadContext context, IRubyObject other, Block block) {
  return ((RubyHash)dup()).merge_bang(context, other, block);
}

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

/** rb_hash_merge
 *
 */
@JRubyMethod
public RubyHash merge(ThreadContext context, IRubyObject other, Block block) {
  return ((RubyHash)dup()).merge_bang(context, other, block);
}

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

@JRubyMethod
public IRubyObject initialize_dup(ThreadContext context, IRubyObject orig) {
  super.initialize_copy(orig);
  setHash((RubyHash) (((RubySet) orig).hash).dup(context));
  return this;
}

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

@JRubyMethod
public IRubyObject initialize_dup(ThreadContext context, IRubyObject orig) {
  super.initialize_copy(orig);
  setHash((RubyHash) (((RubySet) orig).hash).dup(context));
  return this;
}

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

@JRubyMethod(meta = true)
public static IRubyObject list(ThreadContext context, IRubyObject recv) {
  Ruby runtime = recv.getRuntime();
  RubyHash names;
  synchronized (recv) {
    names = (RubyHash) recv.getInternalVariables().getInternalVariable("signal_list");
    if (names == null) {
      names = RubyHash.newHash(runtime);
      for (Map.Entry<String, Integer> sig : RubySignal.list().entrySet()) {
        names.op_aset(context, runtime.freezeAndDedupString(runtime.newString(sig.getKey())), runtime.newFixnum(sig.getValue()));
      }
      names.op_aset(context, runtime.freezeAndDedupString(runtime.newString("EXIT")), runtime.newFixnum(0));
      recv.getInternalVariables().setInternalVariable("signal_list", names);
    } else {
      names.dup(context);
    }
  }
  
  return names;
}

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

@JRubyMethod(meta = true)
public static IRubyObject list(ThreadContext context, IRubyObject recv) {
  Ruby runtime = recv.getRuntime();
  RubyHash names;
  synchronized (recv) {
    names = (RubyHash) recv.getInternalVariables().getInternalVariable("signal_list");
    if (names == null) {
      names = RubyHash.newHash(runtime);
      for (Map.Entry<String, Integer> sig : RubySignal.list().entrySet()) {
        names.op_aset(context, runtime.freezeAndDedupString(runtime.newString(sig.getKey())), runtime.newFixnum(sig.getValue()));
      }
      names.op_aset(context, runtime.freezeAndDedupString(runtime.newString("EXIT")), runtime.newFixnum(0));
      recv.getInternalVariables().setInternalVariable("signal_list", names);
    } else {
      names.dup(context);
    }
  }
  
  return names;
}

相关文章

微信公众号

最新文章

更多

RubyHash类方法