// @RubyLevelMethod(name="scan") public RubyValue scan(RubyValue arg, RubyBlock block) { RubyRegexp regex = (RubyRegexp) arg; if (null != block) { regex.scan(sb_.toString(), block); return this; } else { return regex.scan(sb_.toString()); } }
@Specialization public RubyArray scan(RubyString string, RubyRegexp regexp) { return RubyArray.specializedFromObjects( getContext().getCoreLibrary().getArrayClass(), regexp.scan(string)); }