Sha256: 47957f9edd09f60a7a8b53d153b1c43ea564d9e219f0f1b689971571585fbd60

Contents?: true

Size: 432 Bytes

Versions: 12

Compression:

Stored size: 432 Bytes

Contents

class File

  # def self.is_bin?(f)
  #   file_test = %x(file #{f})

  #   # http://stackoverflow.com/a/8873922
  #   file_test = file_test.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '').encode('UTF-8', 'UTF-16')

  #   file_test !~ /text/
  # end

  def File.binary? name
    open name do |f|
      while (b=f.read(256)) do
        return true if b[ "\0"]
      end
    end
    false
  end

end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
scms-4.5.1 lib/scms/extensions.rb
scms-4.5.0 lib/scms/extensions.rb
scms-4.4.9 lib/scms/extensions.rb
scms-4.4.8 lib/scms/extensions.rb
scms-4.4.6 lib/scms/extensions.rb
scms-4.4.5 lib/scms/extensions.rb
scms-4.4.4 lib/scms/extensions.rb
scms-4.4.3 lib/scms/extensions.rb
scms-4.4.2 lib/scms/extensions.rb
scms-4.4.1 lib/scms/extensions.rb
scms-4.4.0 lib/scms/extensions.rb
scms-4.3.0 lib/scms/extensions.rb