os/mac: Use delegation for Mach-O methods

This commit is contained in:
William Woodruff 2019-03-10 21:05:51 -04:00
parent 54aca0d14f
commit a8c4136e9e
No known key found for this signature in database
GPG Key ID: 600D68320BE45ACC

View File

@ -2,6 +2,10 @@ require "macho"
require "os/mac/architecture_list"
module MachOShim
extend Forwardable
delegate [:dylib_id, :rpaths, :delete_rpath] => :macho
# @private
def macho
@macho ||= begin
@ -56,18 +60,6 @@ module MachOShim
lcs.map(&:name).map(&:to_s).uniq
end
def dylib_id
macho.dylib_id
end
def rpaths
macho.rpaths
end
def delete_rpath(rpath)
macho.delete_rpath(rpath)
end
def archs
mach_data.map { |m| m.fetch :arch }.extend(ArchitectureListExtension)
end