Method: ShellHelpers::PathnameExt::Base#binary?

Defined in:
lib/shell_helpers/pathname.rb

#binary?Boolean

Returns:

  • (Boolean)


167
168
169
170
171
172
173
174
175
# File 'lib/shell_helpers/pathname.rb', line 167

def binary?
	return false if directory?
	bytes = stat.blksize
	bytes = 4096 if bytes > 4096
	s = read(bytes, bytes) || ""
	#s = s.encode('US-ASCII', :undef => :replace).split(//)
	s=s.split(//)
	((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
end