Module: MachOShim Private

Extended by:
Forwardable
Defined in:
Library/Homebrew/os/mac/mach.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Pathname extension for dealing with Mach-O files.

Instance Method Summary collapse

Instance Method Details

#archObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


72
73
74
75
76
77
78
# File 'Library/Homebrew/os/mac/mach.rb', line 72

def arch
  case archs.length
  when 0 then :dunno
  when 1 then archs.first
  else :universal
  end
end

#archsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


68
69
70
# File 'Library/Homebrew/os/mac/mach.rb', line 68

def archs
  mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension)
end

#dylib?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

100
101
102
# File 'Library/Homebrew/os/mac/mach.rb', line 100

def dylib?
  mach_data.any? { |m| m.fetch(:type) == :dylib }
end

#dynamically_linked_libraries(except: :none) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


62
63
64
65
66
# File 'Library/Homebrew/os/mac/mach.rb', line 62

def dynamically_linked_libraries(except: :none)
  lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }

  lcs.map(&:name).map(&:to_s).uniq
end

#i386?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

84
85
86
# File 'Library/Homebrew/os/mac/mach.rb', line 84

def i386?
  arch == :i386
end

#mach_o_bundle?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

110
111
112
# File 'Library/Homebrew/os/mac/mach.rb', line 110

def mach_o_bundle?
  mach_data.any? { |m| m.fetch(:type) == :bundle }
end

#mach_o_executable?Boolean Also known as: binary_executable?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

104
105
106
# File 'Library/Homebrew/os/mac/mach.rb', line 104

def mach_o_executable?
  mach_data.any? { |m| m.fetch(:type) == :executable }
end

#ppc64?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

96
97
98
# File 'Library/Homebrew/os/mac/mach.rb', line 96

def ppc64?
  arch == :ppc64
end

#ppc7400?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

92
93
94
# File 'Library/Homebrew/os/mac/mach.rb', line 92

def ppc7400?
  arch == :ppc7400
end

#universal?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

80
81
82
# File 'Library/Homebrew/os/mac/mach.rb', line 80

def universal?
  arch == :universal
end

#x86_64?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)

88
89
90
# File 'Library/Homebrew/os/mac/mach.rb', line 88

def x86_64?
  arch == :x86_64
end