// @RubyLevelMethod(name="collect!") public RubyValue collect_danger(RubyBlock block) { RubyArray a = (RubyArray) RubyAPI.callPublicNoArgMethod(this, block, RubyID.intern("collect")); clear(); for (int i = 0; i < a.size(); i++) { add(a.get(i)); } return this; }
public RubyString appendString(RubyValue v) { if (v instanceof RubyString) { return appendString((RubyString) v); } else { RubyValue r = RubyAPI.callPublicNoArgMethod(v, null, RubyID.toSID); if (r instanceof RubyString) return appendString((RubyString) r); return ObjectFactory.createString(r.toString()); } }
public int appendString2(RubyValue v) { RubyString str = null; if (v instanceof RubyString) { str = (RubyString) v; } else { RubyValue r = RubyAPI.callPublicNoArgMethod(v, null, RubyID.toSID); str = (RubyString) r; } appendString(str); return str.length(); }