Module: MachOShim Private

Extended by:
Forwardable
Included in:
Pathname
Defined in:
os/mac/mach.rb

Overview

This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.

Pathname extension for dealing with Mach-O files.

Instance Method Summary collapse

Instance Method Details

#archObject

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



70
71
72
73
74
75
76
# File 'os/mac/mach.rb', line 70

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



66
67
68
# File 'os/mac/mach.rb', line 66

def archs
  mach_data.map { |m| m.fetch :arch }
end

#dylib?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


98
99
100
# File 'os/mac/mach.rb', line 98

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



60
61
62
63
64
# File 'os/mac/mach.rb', line 60

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


82
83
84
# File 'os/mac/mach.rb', line 82

def i386?
  arch == :i386
end

#mach_o_bundle?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


108
109
110
# File 'os/mac/mach.rb', line 108

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. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


102
103
104
# File 'os/mac/mach.rb', line 102

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

#ppc64?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


94
95
96
# File 'os/mac/mach.rb', line 94

def ppc64?
  arch == :ppc64
end

#ppc7400?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


90
91
92
# File 'os/mac/mach.rb', line 90

def ppc7400?
  arch == :ppc7400
end

#universal?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


78
79
80
# File 'os/mac/mach.rb', line 78

def universal?
  arch == :universal
end

#x86_64?Boolean

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Returns:

  • (Boolean)


86
87
88
# File 'os/mac/mach.rb', line 86

def x86_64?
  arch == :x86_64
end