Skip to content

Commit

Permalink
Add inline type annotation for empty array
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Dec 10, 2024
1 parent 54ddda6 commit 92dd4d5
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/x/media_uploader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ def infer_media_type(file_path, media_category)

def split(file_path, chunk_size)
file_number = -1
file_paths = [] # @type var file_paths: Array[String]

[].tap do |file_paths|
File.open(file_path, "rb") do |f|
while (chunk = f.read(chunk_size))
file_paths << "#{Dir.mktmpdir}/x#{format("%03d", file_number += 1)}".tap do |path|
File.binwrite(path, chunk)
end
end
File.open(file_path, "rb") do |f|
while (chunk = f.read(chunk_size))
path = "#{Dir.mktmpdir}/x#{format("%03d", file_number += 1)}"
File.binwrite(path, chunk)
file_paths << path
end
end
file_paths
end

def init(upload_client:, file_path:, media_type:, media_category:)
Expand Down

0 comments on commit 92dd4d5

Please sign in to comment.