Skip to content

Commit 73c914e

Browse files
nobuhsbt
authored andcommitted
Use class methods of File over Kernel.open and IO.read
1 parent 14612a7 commit 73c914e

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lib/webrick/httputils.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def normalize_path(path)
123123
def load_mime_types(file)
124124
# note: +file+ may be a "| command" for now; some people may
125125
# rely on this, but currently we do not use this method by default.
126-
open(file){ |io|
126+
File.open(file){ |io|
127127
hash = Hash.new
128128
io.each{ |line|
129129
next if /^#/ =~ line

test/webrick/test_filehandler.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ def test_make_partial_content
8585
"Content-Type: text/plain\r\n" \
8686
"Content-Range: bytes 0-0/#{filesize}\r\n" \
8787
"\r\n" \
88-
"#{IO.read(__FILE__, 1)}\r\n" \
88+
"#{File.read(__FILE__, 1)}\r\n" \
8989
"--#{boundary}\r\n" \
9090
"Content-Type: text/plain\r\n" \
9191
"Content-Range: bytes #{off}-#{last}/#{filesize}\r\n" \
9292
"\r\n" \
93-
"#{IO.read(__FILE__, 2, off)}\r\n" \
93+
"#{File.read(__FILE__, 2, off)}\r\n" \
9494
"--#{boundary}--\r\n"
9595
assert_equal exp, body
9696
end

test/webrick/test_httprequest.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def test_chunked
245245
246246
_end_of_message_
247247
msg.gsub!(/^ {6}/, "")
248-
open(__FILE__){|io|
248+
File.open(__FILE__){|io|
249249
while chunk = io.read(100)
250250
msg << chunk.size.to_s(16) << crlf
251251
msg << chunk << crlf

0 commit comments

Comments
 (0)