本文整理了Java中org.jruby.Ruby.newKeyError
方法的一些代码示例,展示了Ruby.newKeyError
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.newKeyError
方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:newKeyError
暂无
代码示例来源:origin: org.jruby/jruby-complete
void raiseKeyError(String message, IRubyObject recv, IRubyObject key) {
throw runtime.newKeyError(message, recv, key);
}
代码示例来源:origin: org.jruby/jruby-core
void raiseKeyError(String message, IRubyObject recv, IRubyObject key) {
throw runtime.newKeyError(message, recv, key);
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
void raiseKeyError(String message) {
throw runtime.newKeyError(message);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
void raiseKeyError(String message) {
throw runtime.newKeyError(message);
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@JRubyMethod(compat = RUBY1_9)
public IRubyObject fetch(ThreadContext context, IRubyObject key, Block block) {
Ruby runtime = context.runtime;
IRubyObject value = internalGet(key);
if (value == null) {
if (block.isGiven()) return block.yield(context, key);
throw runtime.newKeyError("key not found: " + key);
}
return value;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@JRubyMethod(compat = RUBY1_9)
public IRubyObject fetch(ThreadContext context, IRubyObject key, Block block) {
Ruby runtime = context.runtime;
IRubyObject value = internalGet(key);
if (value == null) {
if (block.isGiven()) return block.yield(context, key);
throw runtime.newKeyError("key not found: " + key);
}
return value;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject fetch(ThreadContext context, IRubyObject key, Block block) {
Ruby runtime = context.runtime;
IRubyObject value = internalGet(key);
if (value == null) {
if (block.isGiven()) return block.yield(context, key);
throw runtime.newKeyError("key not found: " + key.inspect(), this, key);
}
return value;
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject fetch(ThreadContext context, IRubyObject key, Block block) {
Ruby runtime = context.runtime;
IRubyObject value = internalGet(key);
if (value == null) {
if (block.isGiven()) return block.yield(context, key);
throw runtime.newKeyError("key not found: " + key.inspect(), this, key);
}
return value;
}
代码示例来源:origin: org.jruby/jruby-core
@JRubyMethod
public IRubyObject fetch(ThreadContext context, IRubyObject key, Block block) {
Ruby runtime = context.runtime;
IRubyObject value = op_aref(key);
if (value.isNil()) {
if (block.isGiven()) return block.yield(context, key);
throw runtime.newKeyError("key not found: " + key.inspect(), this, key);
}
return value;
}
代码示例来源:origin: org.jruby/jruby-complete
@JRubyMethod
public IRubyObject fetch(ThreadContext context, IRubyObject key, Block block) {
Ruby runtime = context.runtime;
IRubyObject value = op_aref(key);
if (value.isNil()) {
if (block.isGiven()) return block.yield(context, key);
throw runtime.newKeyError("key not found: " + key.inspect(), this, key);
}
return value;
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
/** rb_hash_fetch
*
*/
@JRubyMethod(required = 1, optional = 1, compat = RUBY1_8)
public IRubyObject fetch(ThreadContext context, IRubyObject[] args, Block block) {
Ruby runtime = context.runtime;
if (args.length == 2 && block.isGiven()) {
runtime.getWarnings().warn(ID.BLOCK_BEATS_DEFAULT_VALUE, "block supersedes default value argument");
}
IRubyObject value = internalGet(args[0]);
if (value == null) {
if (block.isGiven()) return block.yield(context, args[0]);
if (args.length == 1) {
if (runtime.is1_9()) {
throw runtime.newKeyError("key not found: " + args[0]);
} else {
throw runtime.newIndexError("key not found");
}
}
return args[1];
}
return value;
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
/** rb_hash_fetch
*
*/
@JRubyMethod(required = 1, optional = 1, compat = RUBY1_8)
public IRubyObject fetch(ThreadContext context, IRubyObject[] args, Block block) {
Ruby runtime = context.runtime;
if (args.length == 2 && block.isGiven()) {
runtime.getWarnings().warn(ID.BLOCK_BEATS_DEFAULT_VALUE, "block supersedes default value argument");
}
IRubyObject value = internalGet(args[0]);
if (value == null) {
if (block.isGiven()) return block.yield(context, args[0]);
if (args.length == 1) {
if (runtime.is1_9()) {
throw runtime.newKeyError("key not found: " + args[0]);
} else {
throw runtime.newIndexError("key not found");
}
}
return args[1];
}
return value;
}
代码示例来源:origin: org.jruby/jruby-complete
throw runtime.newKeyError("key " + nameSym + " not found", rubyHash, nameSym);
代码示例来源:origin: org.jruby/jruby-core
throw runtime.newKeyError("key " + nameSym + " not found", rubyHash, nameSym);
代码示例来源:origin: org.jruby/jruby-complete
private IRubyObject getHashValue(ByteList name, char startDelim, char endDelim) {
// FIXME: get_hash does hash conversion of argv and arity check...this is a bit complicated with
// our version. Implement it.
if (rubyHash == null) {
raiseArgumentError("one hash required");
}
checkNameArg(name, startDelim, endDelim);
RubySymbol nameSym = runtime.newSymbol(name);
IRubyObject object = rubyHash.fastARef(nameSym);
// if not found, try dispatching to pick up default hash value
// MRI: spliced together bits from rb_hash_default_value
if (object == null) {
object = rubyHash.getIfNone();
if (object == RubyBasicObject.UNDEF) {
RubyString nameStr = RubyString.newString(runtime, name);
raiseKeyError("key" + startDelim + nameStr + endDelim + " not found", rubyHash, nameSym);
} else if (rubyHash.hasDefaultProc()) {
object = object.callMethod(runtime.getCurrentContext(), "call", nameSym);
}
if (object.isNil()) throw runtime.newKeyError("key" + startDelim + nameSym + endDelim + " not found", rubyHash, nameSym);
}
return object;
}
代码示例来源:origin: org.jruby/jruby-core
private IRubyObject getHashValue(ByteList name, char startDelim, char endDelim) {
// FIXME: get_hash does hash conversion of argv and arity check...this is a bit complicated with
// our version. Implement it.
if (rubyHash == null) {
raiseArgumentError("one hash required");
}
checkNameArg(name, startDelim, endDelim);
RubySymbol nameSym = runtime.newSymbol(name);
IRubyObject object = rubyHash.fastARef(nameSym);
// if not found, try dispatching to pick up default hash value
// MRI: spliced together bits from rb_hash_default_value
if (object == null) {
object = rubyHash.getIfNone();
if (object == RubyBasicObject.UNDEF) {
RubyString nameStr = RubyString.newString(runtime, name);
raiseKeyError("key" + startDelim + nameStr + endDelim + " not found", rubyHash, nameSym);
} else if (rubyHash.hasDefaultProc()) {
object = object.callMethod(runtime.getCurrentContext(), "call", nameSym);
}
if (object.isNil()) throw runtime.newKeyError("key" + startDelim + nameSym + endDelim + " not found", rubyHash, nameSym);
}
return object;
}
内容来源于网络,如有侵权,请联系作者删除!