From d752cf7601adbe4bc2dc658effc2f61563a7dfb7 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 25 Nov 2022 14:22:37 +0900 Subject: Use class methods of `File` over `Kernel.open` and `IO.read` --- tool/test/webrick/test_filehandler.rb | 4 ++-- tool/test/webrick/test_httprequest.rb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tool/test') diff --git a/tool/test/webrick/test_filehandler.rb b/tool/test/webrick/test_filehandler.rb index 146d8ce792..9c5b83e300 100644 --- a/tool/test/webrick/test_filehandler.rb +++ b/tool/test/webrick/test_filehandler.rb @@ -85,12 +85,12 @@ class WEBrick::TestFileHandler < Test::Unit::TestCase "Content-Type: text/plain\r\n" \ "Content-Range: bytes 0-0/#{filesize}\r\n" \ "\r\n" \ - "#{IO.read(__FILE__, 1)}\r\n" \ + "#{File.read(__FILE__, 1)}\r\n" \ "--#{boundary}\r\n" \ "Content-Type: text/plain\r\n" \ "Content-Range: bytes #{off}-#{last}/#{filesize}\r\n" \ "\r\n" \ - "#{IO.read(__FILE__, 2, off)}\r\n" \ + "#{File.read(__FILE__, 2, off)}\r\n" \ "--#{boundary}--\r\n" assert_equal exp, body end diff --git a/tool/test/webrick/test_httprequest.rb b/tool/test/webrick/test_httprequest.rb index 759ccbdada..3c0ea937d9 100644 --- a/tool/test/webrick/test_httprequest.rb +++ b/tool/test/webrick/test_httprequest.rb @@ -245,7 +245,7 @@ GET / _end_of_message_ msg.gsub!(/^ {6}/, "") - open(__FILE__){|io| + File.open(__FILE__){|io| while chunk = io.read(100) msg << chunk.size.to_s(16) << crlf msg << chunk << crlf -- cgit v1.2.1