Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions core/string.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -3665,7 +3665,7 @@ class String
# Related: see [Converting to New
# String](rdoc-ref:String@Converting+to+New+String).
#
def lstrip: () -> String
def lstrip: (*selector) -> String

# <!--
# rdoc-file=string.c
Expand All @@ -3678,7 +3678,7 @@ class String
#
# Related: see [Modifying](rdoc-ref:String@Modifying).
#
def lstrip!: () -> self?
def lstrip!: (*selector) -> self?

# <!--
# rdoc-file=string.c
Expand Down Expand Up @@ -4191,7 +4191,7 @@ class String
# Related: see [Converting to New
# String](rdoc-ref:String@Converting+to+New+String).
#
def rstrip: () -> String
def rstrip: (*selector) -> String

# <!--
# rdoc-file=string.c
Expand All @@ -4204,7 +4204,7 @@ class String
#
# Related: see [Modifying](rdoc-ref:String@Modifying).
#
def rstrip!: () -> self?
def rstrip!: (*selector) -> self?

# <!--
# rdoc-file=string.c
Expand Down Expand Up @@ -4677,7 +4677,7 @@ class String
# Related: see [Converting to New
# String](rdoc-ref:String@Converting+to+New+String).
#
def strip: () -> String
def strip: (*selector) -> String

# <!--
# rdoc-file=string.c
Expand All @@ -4690,7 +4690,7 @@ class String
#
# Related: see [Modifying](rdoc-ref:String@Modifying).
#
def strip!: () -> self?
def strip!: (*selector) -> self?

# <!--
# rdoc-file=string.c
Expand Down
42 changes: 42 additions & 0 deletions test/stdlib/String_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1099,13 +1099,27 @@ def test_lstrip
' hello', :lstrip
assert_send_type '() -> String',
'hello', :lstrip

if_ruby("4.0"...) do
with_string "0-9" do |selector|
assert_send_type '(String::selector) -> String',
"01234abc56789", :lstrip, selector
end
end
end

def test_lstrip!
assert_send_type '() -> String',
+' hello', :lstrip!
assert_send_type '() -> nil',
+'hello', :lstrip!

if_ruby("4.0"...) do
with_string "0-9" do |selector|
assert_send_type '(String::selector) -> String',
"01234abc56789", :lstrip!, selector
end
end
end

def test_match
Expand Down Expand Up @@ -1252,13 +1266,27 @@ def test_rstrip
'hello ', :rstrip
assert_send_type '() -> String',
'hello', :rstrip

if_ruby("4.0"...) do
with_string "0-9" do |selector|
assert_send_type '(String::selector) -> String',
"01234abc56789", :rstrip, selector
end
end
end

def test_rstrip!
assert_send_type '() -> String',
+'hello ', :rstrip!
assert_send_type '() -> nil',
+'hello', :rstrip!

if_ruby("4.0"...) do
with_string "0-9" do |selector|
assert_send_type '(String::selector) -> String',
"01234abc56789", :rstrip!, selector
end
end
end

def test_scan
Expand Down Expand Up @@ -1491,13 +1519,27 @@ def test_strip
' hello ', :strip
assert_send_type '() -> String',
'hello', :strip

if_ruby("4.0"...) do
with_string "0-9" do |selector|
assert_send_type '(String::selector) -> String',
"01234abc56789", :strip, selector
end
end
end

def test_strip!
assert_send_type '() -> String',
' hello ', :strip!
assert_send_type '() -> nil',
'hello', :strip!

if_ruby("4.0"...) do
with_string "0-9" do |selector|
assert_send_type '(String::selector) -> String',
"01234abc56789", :strip!, selector
end
end
end

def test_sub
Expand Down