[ruby/rdoc] Use Marshal.load io instead of Marshal.load io.read

https://github.com/ruby/rdoc/commit/135198a31c
This commit is contained in:
Kazuhiro NISHIYAMA 2022-03-02 13:05:36 +09:00 committed by git
parent 0c90ca4dd0
commit fd2e1d3c4a

View File

@ -557,7 +557,7 @@ class RDoc::Store
#orig_enc = @encoding #orig_enc = @encoding
File.open cache_path, 'rb' do |io| File.open cache_path, 'rb' do |io|
@cache = Marshal.load io.read @cache = Marshal.load io
end end
load_enc = @cache[:encoding] load_enc = @cache[:encoding]
@ -616,7 +616,7 @@ class RDoc::Store
file = class_file klass_name file = class_file klass_name
File.open file, 'rb' do |io| File.open file, 'rb' do |io|
Marshal.load io.read Marshal.load io
end end
rescue Errno::ENOENT => e rescue Errno::ENOENT => e
error = MissingFileError.new(self, file, klass_name) error = MissingFileError.new(self, file, klass_name)
@ -631,7 +631,7 @@ class RDoc::Store
file = method_file klass_name, method_name file = method_file klass_name, method_name
File.open file, 'rb' do |io| File.open file, 'rb' do |io|
obj = Marshal.load io.read obj = Marshal.load io
obj.store = self obj.store = self
obj.parent = obj.parent =
find_class_or_module(klass_name) || load_class(klass_name) unless find_class_or_module(klass_name) || load_class(klass_name) unless
@ -651,7 +651,7 @@ class RDoc::Store
file = page_file page_name file = page_file page_name
File.open file, 'rb' do |io| File.open file, 'rb' do |io|
obj = Marshal.load io.read obj = Marshal.load io
obj.store = self obj.store = self
obj obj
end end