summaryrefslogtreecommitdiff
path: root/lib/rdoc/store.rb
diff options
context:
space:
mode:
authorYusuke Endoh <mame@ruby-lang.org>2019-08-16 21:27:05 +0900
committerYusuke Endoh <mame@ruby-lang.org>2019-08-16 21:27:05 +0900
commit229ae3269d622954295e4220fa7bc3298cad8b1d (patch)
tree286a6d54c222b6a6c53b8266dde580b34dc45c95 /lib/rdoc/store.rb
parent619f82bb6bd913d8dbb8ca5da15ca1fbb4508629 (diff)
lib/rdoc/store.rb: Use `Marshal.dump(obj, io)`
instead of dumping obj to a string and then saving the string. It omits object creation.
Diffstat (limited to 'lib/rdoc/store.rb')
-rw-r--r--lib/rdoc/store.rb16
1 files changed, 4 insertions, 12 deletions
diff --git a/lib/rdoc/store.rb b/lib/rdoc/store.rb
index f420fc2bd2..0f6cd06e3c 100644
--- a/lib/rdoc/store.rb
+++ b/lib/rdoc/store.rb
@@ -795,10 +795,8 @@ class RDoc::Store
return if @dry_run
- marshal = Marshal.dump @cache
-
File.open cache_path, 'wb' do |io|
- io.write marshal
+ Marshal.dump @cache, io
end
end
@@ -871,10 +869,8 @@ class RDoc::Store
FileUtils.rm_f to_delete
- marshal = Marshal.dump klass
-
File.open path, 'wb' do |io|
- io.write marshal
+ Marshal.dump klass, io
end
end
@@ -896,10 +892,8 @@ class RDoc::Store
return if @dry_run
- marshal = Marshal.dump method
-
File.open method_file(full_name, method.full_name), 'wb' do |io|
- io.write marshal
+ Marshal.dump method, io
end
end
@@ -918,10 +912,8 @@ class RDoc::Store
return if @dry_run
- marshal = Marshal.dump page
-
File.open path, 'wb' do |io|
- io.write marshal
+ Marshal.dump page, io
end
end