binary?(file)
private
Shamelessly stolen from the ptools gem (since RDoc
cannot depend on the gem).
# File lib/rdoc/parser.rb, line 69
def self.binary?(file)
s = (File.read(file, File.stat(file).blksize, 0, :mode => "rb") || "").split(//)
if s.size > 0 then
((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
else
false
end
end