Skip to content

Commit c958f48

Browse files
committed
Kernel#gets and ARGF#gets *also* accept chomp: true
1 parent f00a84f commit c958f48

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

core/kernel.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ module Kernel : BasicObject
11631163
# The style of programming using `$_` as an implicit parameter is gradually
11641164
# losing favor in the Ruby community.
11651165
#
1166-
def self?.gets: (?String arg0, ?Integer arg1) -> String?
1166+
def self?.gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String?
11671167

11681168
# <!--
11691169
# rdoc-file=eval.c

core/rbs/unnamed/argf.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -639,7 +639,7 @@ module RBS
639639
# See IO.readlines for details about getline_args.
640640
#
641641
%a{annotate:rdoc:copy:ARGF#gets}
642-
def gets: (?String sep, ?Integer limit) -> String?
642+
def gets: (?String sep, ?Integer limit, ?chomp: boolish) -> String?
643643

644644
# <!--
645645
# rdoc-file=io.c

test/stdlib/ARGF_test.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ def test_gets
2727
ARGF.class.new(__FILE__), :gets, "\n"
2828
assert_send_type "(::String sep, ::Integer limit) -> ::String",
2929
ARGF.class.new(__FILE__), :gets, "\n", 1
30+
assert_send_type "(chomp: boolish) -> ::String",
31+
ARGF.class.new(__FILE__), :gets, chomp: true
32+
assert_send_type "(::String sep, ::Integer limit, chomp: boolish) -> ::String",
33+
ARGF.class.new(__FILE__), :gets, "\n", 1, chomp: true
3034
assert_send_type "() -> nil",
3135
ARGF.class.new(Tempfile.new), :gets
3236
end

0 commit comments

Comments
 (0)