diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-21 16:20:17 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-11-21 22:16:49 +0900 |
commit | 612aa5c24a7c249867bbcd7d6567012aa6a7f4b9 (patch) | |
tree | 35581bf73b35123b08cc2ac9c9f453ab0010ff69 /tool/make_hgraph.rb | |
parent | 116920cff8739c49ba469bf243252f503e28f0fd (diff) | |
download | ruby-612aa5c24a7c249867bbcd7d6567012aa6a7f4b9.tar.gz |
Use class methods of `File` over `Kernel.open` and `IO.read`
Diffstat (limited to 'tool/make_hgraph.rb')
-rw-r--r-- | tool/make_hgraph.rb | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/tool/make_hgraph.rb b/tool/make_hgraph.rb index 0f388814dd..174fa5dd2f 100644 --- a/tool/make_hgraph.rb +++ b/tool/make_hgraph.rb @@ -83,13 +83,12 @@ module ObjectSpace def self.module_refenreces_image klass, file dot = module_refenreces_dot(klass) - img = nil - IO.popen("dot -Tpng", 'r+'){|io| + img = IO.popen(%W"dot -Tpng", 'r+b') {|io| # io.puts dot io.close_write - img = io.read + io.read } - open(File.expand_path(file), 'w+'){|f| f.puts img} + File.binwrite(file, img) end end |