Skip to content

Commit

Permalink
Update Tempfile.create
Browse files Browse the repository at this point in the history
  • Loading branch information
soutaro committed Dec 19, 2024
1 parent 53c8e4e commit ba6d311
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stdlib/tempfile/0/tempfile.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,8 @@ class Tempfile < File
#
# Related: Tempfile.new.
#
def self.create: (?String | [ String, String ] basename, ?String? tmpdir, ?mode: Integer, **untyped) -> File
| [A] (?String | [ String, String ] basename, ?String? tmpdir, ?mode: Integer, **untyped) { (File) -> A } -> A
def self.create: (?String | [ String, String ] basename, ?String? tmpdir, ?mode: Integer, ?anonymous: bool, **untyped) -> File
| [A] (?String | [ String, String ] basename, ?String? tmpdir, ?mode: Integer, ?anonymous: bool, **untyped) { (File) -> A } -> A

# <!--
# rdoc-file=lib/tempfile.rb
Expand Down
11 changes: 11 additions & 0 deletions test/stdlib/tempfile/Tempfile_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ def test_create

assert_send_type "() { (::File) -> Integer } -> Integer",
Tempfile, :create do |file| 123 end

if_ruby("3.4"..., skip: false) do
assert_send_type(
"(anonymous: true) -> File",
Tempfile, :create, anonymous: true
)
assert_send_type(
"(anonymous: true) { (File) -> String } -> String",
Tempfile, :create, anonymous: true, &->(file) { "test" }
)
end
end

def test_initialize
Expand Down

0 comments on commit ba6d311

Please sign in to comment.