Skip to content

Commit

Permalink
Merge pull request #8228 from enebo/readlines
Browse files Browse the repository at this point in the history
IO#readlines accepts another arg
  • Loading branch information
enebo committed May 8, 2024
2 parents 491e645 + 1e97d2e commit 3728d65
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/src/main/java/org/jruby/RubyIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -4342,7 +4342,7 @@ static IRubyObject seekBeforeAccess(ThreadContext context, RubyIO io, IRubyObjec
}

// rb_io_s_readlines
@JRubyMethod(name = "readlines", required = 1, optional = 2, checkArity = false, meta = true)
@JRubyMethod(name = "readlines", required = 1, optional = 3, checkArity = false, meta = true)
public static IRubyObject readlines(ThreadContext context, IRubyObject recv, IRubyObject[] args, Block unusedBlock) {
IRubyObject opt = ArgsUtil.getOptionsArg(context.runtime, args);
final RubyIO io = openKeyArgs(context, recv, args, opt);
Expand All @@ -4357,6 +4357,8 @@ public static IRubyObject readlines(ThreadContext context, IRubyObject recv, IRu
case 3:
if (opt != context.nil) return io.readlines(context, args[1], opt);
return io.readlines(context, args[1], args[2]);
case 4:
return io.readlines(context, args[1], args[2], args[3]);
default:
Arity.raiseArgumentError(context, args.length, 1, 3);
throw new AssertionError("BUG");
Expand Down

0 comments on commit 3728d65

Please sign in to comment.