class Excavate::FileMagic

Public Class Methods

detect(path) click to toggle source
# File lib/excavate/file_magic.rb, line 3
def self.detect(path)
  new(path).detect
end
new(path) click to toggle source
# File lib/excavate/file_magic.rb, line 7
def initialize(path)
  @path = path
end

Public Instance Methods

detect() click to toggle source
# File lib/excavate/file_magic.rb, line 11
def detect
  case File.read(@path, 8, mode: "rb")
  when "MSCF\x00\x00\x00\x00".force_encoding("BINARY")
    :cab
  end
end