Sha256: 9700fe2f9aea5cebb8d9c887ddde8fe2cad2d94cd9017fa4986691c96b7395b4
Contents?: true
Size: 416 Bytes
Versions: 1
Compression:
Stored size: 416 Bytes
Contents
# # Adapted ptools - http://rdoc.info/gems/ptools/1.2.1/File.binary%3F # class String def binary? # s = (File.read(file, File.stat(file).blksize) || "").split(//) s = (self[0..4096].force_encoding('binary') || '') # .split(//) ratio = s.gsub(/\d|\w|\s|[-~\.]/, '').size / s.size.to_f # if Opt[:debug] # print "Detecting #{s}" # puts "Ratio #{ratio}" # end ratio > 0.3 end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
assetify-3.0.0 | lib/assetify/extensions/string.rb |