I have a text file for example. What is the best way to check in Ruby that a file is empty? File.size('test.rb') == 0 looks ugly.
File.size('test.rb') == 0
You could use the zero? method:
zero?
File.zero?("test.rb")
2.1m questions
2.1m answers
60 comments
57.0k users