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.


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

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.


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

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)

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

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.


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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

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)

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

def x86_64?
  arch == :x86_64
end