Use short syntax for 'File.open' block

This commit is contained in:
Samantaz Fox 2022-01-29 13:43:26 +01:00 committed by GitHub
parent 6f4665588f
commit 519c227c4f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -175,8 +175,7 @@ module Kemal
if @cached_files.sum(&.[1][:data].bytesize) + (size = File.size(file_path)) < CACHE_LIMIT if @cached_files.sum(&.[1][:data].bytesize) + (size = File.size(file_path)) < CACHE_LIMIT
data = Bytes.new(size) data = Bytes.new(size)
File.open(file_path, &.read(data))
File.open(file_path) { |f| f.read(data) }
filestat = File.info(file_path) filestat = File.info(file_path)