2018-07-16 09:16:50 +02:00

19 lines
390 B
Ruby

require "hbc/container/naked"
require "vendor/macho/macho"
module Hbc
class Container
class Executable < Naked
def self.can_extract?(path:, magic_number:)
return true if magic_number.match?(/\A#!\s*\S+/n)
begin
path.file? && MachO.open(path).header.executable?
rescue MachO::MagicError
false
end
end
end
end
end