Document MachOShim.
This commit is contained in:
parent
f7cb6a95b6
commit
390deeb5ac
@ -3,19 +3,21 @@
|
||||
require "macho"
|
||||
require "os/mac/architecture_list"
|
||||
|
||||
# {Pathname} extension for dealing with Mach-O files.
|
||||
#
|
||||
# @api private
|
||||
module MachOShim
|
||||
extend Forwardable
|
||||
|
||||
delegate [:dylib_id, :rpaths, :delete_rpath] => :macho
|
||||
|
||||
# @private
|
||||
def macho
|
||||
@macho ||= begin
|
||||
MachO.open(to_s)
|
||||
end
|
||||
end
|
||||
private :macho
|
||||
|
||||
# @private
|
||||
def mach_data
|
||||
@mach_data ||= begin
|
||||
machos = []
|
||||
@ -55,6 +57,7 @@ module MachOShim
|
||||
[]
|
||||
end
|
||||
end
|
||||
private :mach_data
|
||||
|
||||
def dynamically_linked_libraries(except: :none)
|
||||
lcs = macho.dylib_load_commands.reject { |lc| lc.type == except }
|
||||
@ -94,19 +97,16 @@ module MachOShim
|
||||
arch == :ppc64
|
||||
end
|
||||
|
||||
# @private
|
||||
def dylib?
|
||||
mach_data.any? { |m| m.fetch(:type) == :dylib }
|
||||
end
|
||||
|
||||
# @private
|
||||
def mach_o_executable?
|
||||
mach_data.any? { |m| m.fetch(:type) == :executable }
|
||||
end
|
||||
|
||||
alias binary_executable? mach_o_executable?
|
||||
|
||||
# @private
|
||||
def mach_o_bundle?
|
||||
mach_data.any? { |m| m.fetch(:type) == :bundle }
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user