blob: 61bd4ef9bbc36e9b920552eb56c6f0ec03db172e (
plain)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 | require "hbc/container/naked"
require "macho"
module Hbc
  class Container
    class Executable < Naked
      def self.me?(criteria)
        return true if criteria.magic_number(/^#!\s*\S+/)
        begin
          MachO.open(criteria.path).header.executable?
        rescue MachO::MagicError
          false
        end
      end
    end
  end
end
 |