Class: File

Inherits:
Object show all
Defined in:
lib/fission/core_ext/file.rb

Class Method Summary collapse

Class Method Details

.binary?(file) ⇒ Boolean

from ptools

Returns:

  • (Boolean)


3
4
5
6
# File 'lib/fission/core_ext/file.rb', line 3

def self.binary?(file)
  s = (File.read(file, File.stat(file).blksize) || "").split(//)
  ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
end