Skip to content

Commit ca0f2a0

Browse files
hsbtsoutaro
authored andcommitted
Pathname#mkpath and Pathname#rmtree returns self from Ruby 3.4
1 parent 1877ae5 commit ca0f2a0

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

stdlib/pathname/0/pathname.rbs

+2-2
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ class Pathname
895895
#
896896
# See FileUtils.mkpath and FileUtils.mkdir_p
897897
#
898-
def mkpath: () -> nil
898+
def mkpath: () -> self
899899

900900
# <!--
901901
# rdoc-file=ext/pathname/lib/pathname.rb
@@ -1106,7 +1106,7 @@ class Pathname
11061106
#
11071107
# See FileUtils.rm_rf
11081108
#
1109-
def rmtree: () -> void
1109+
def rmtree: () -> self
11101110

11111111
# <!--
11121112
# rdoc-file=ext/pathname/lib/pathname.rb

test/stdlib/Pathname_test.rb

+4-6
Original file line numberDiff line numberDiff line change
@@ -458,13 +458,11 @@ def test_mkdir
458458
end
459459

460460
def test_mkpath
461-
if_ruby(... 3.4) do
462-
Dir.mktmpdir do |dir|
463-
dir = Pathname(dir)
461+
Dir.mktmpdir do |dir|
462+
dir = Pathname(dir)
464463

465-
assert_send_type '() -> nil',
464+
assert_send_type '() -> Pathname',
466465
dir + 'a/b/c', :mkpath
467-
end
468466
end
469467
end
470468

@@ -644,7 +642,7 @@ def test_rmtree
644642
Dir.mktmpdir do |dir|
645643
target = Pathname(dir).join('target')
646644
target.mkdir
647-
assert_send_type '() -> void',
645+
assert_send_type '() -> Pathname',
648646
target, :rmtree
649647
end
650648
end

0 commit comments

Comments
 (0)