@JRubyMethod(name = "lookup_oneof") public IRubyObject lookupOneof(ThreadContext context, IRubyObject name) { if (name instanceof RubySymbol) { name = ((RubySymbol) name).id2name(); } return oneofDefs.containsKey(name) ? oneofDefs.get(name) : context.runtime.getNil(); }
IRubyObject mapentryDescName = RubySymbol.newSymbol(runtime, name).id2name(context); mapentryDesc.setName(context, mapentryDescName); mapentryDesc.setMapEntry(true);
public static int backrefNumber(Ruby runtime, Regex pattern, Region regs, IRubyObject obj) { if (obj instanceof RubySymbol) { return nameToBackrefNumber(runtime, pattern, regs, (RubyString)((RubySymbol)obj).id2name()); } else if (obj instanceof RubyString) { return nameToBackrefNumber(runtime, pattern, regs, (RubyString)obj); } else { return RubyNumeric.num2int(obj); } }
public static int backrefNumber(Ruby runtime, Regex pattern, Region regs, IRubyObject obj) { if (obj instanceof RubySymbol) { return nameToBackrefNumber(runtime, pattern, regs, (RubyString)((RubySymbol)obj).id2name()); } else if (obj instanceof RubyString) { return nameToBackrefNumber(runtime, pattern, regs, (RubyString)obj); } else { return RubyNumeric.num2int(obj); } }
public final int backrefNumber(IRubyObject obj) { check(); if (obj instanceof RubySymbol) { return nameToBackrefNumber((RubyString)((RubySymbol)obj).id2name()); } else if (obj instanceof RubyString) { return nameToBackrefNumber((RubyString)obj); } else { return RubyNumeric.num2int(obj); } }
public final int backrefNumber(IRubyObject obj) { check(); if (obj instanceof RubySymbol) { return nameToBackrefNumber((RubyString)((RubySymbol)obj).id2name()); } else if (obj instanceof RubyString) { return nameToBackrefNumber((RubyString)obj); } else { return RubyNumeric.num2int(obj); } }
private IRubyObject op_arefCommon(IRubyObject idx) { if (idx instanceof RubyFixnum) { int num = RubyNumeric.fix2int(idx); if (num >= 0) return RubyRegexp.nth_match(num, this); } else { if (idx instanceof RubySymbol) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)((RubySymbol)idx).id2name()), this); } else if (idx instanceof RubyString) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)idx), this); } } return null; }
private IRubyObject op_arefCommon(IRubyObject idx) { if (idx instanceof RubyFixnum) { int num = RubyNumeric.fix2int(idx); if (num >= 0) return RubyRegexp.nth_match(num, this); } else { if (idx instanceof RubySymbol) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)((RubySymbol)idx).id2name()), this); } else if (idx instanceof RubyString) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)idx), this); } } return null; }
private IRubyObject op_arefCommon(IRubyObject idx) { if (idx instanceof RubyFixnum) { int num = RubyNumeric.fix2int(idx); if (num >= 0) return RubyRegexp.nth_match(num, this); } else { if (idx instanceof RubySymbol) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)((RubySymbol)idx).id2name()), this); } else if (idx instanceof RubyString) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)idx), this); } } return null; }
private IRubyObject op_arefCommon(IRubyObject idx) { if (idx instanceof RubyFixnum) { int num = RubyNumeric.fix2int(idx); if (num >= 0) return RubyRegexp.nth_match(num, this); } else { if (idx instanceof RubySymbol) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)((RubySymbol)idx).id2name()), this); } else if (idx instanceof RubyString) { return RubyRegexp.nth_match(nameToBackrefNumber((RubyString)idx), this); } } return null; }