Class: MachO::LoadCommands::BuildVersionCommand::ToolEntries

Inherits:
Object
  • Object
show all
Defined in:
lib/macho/load_commands.rb

Overview

A representation of the tool versions exposed by a MachO::LoadCommands::BuildVersionCommand (LC_BUILD_VERSION).

Defined Under Namespace

Classes: Tool

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(view, ntools) ⇒ ToolEntries

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 a new instance of ToolEntries.

Parameters:

  • view (MachO::MachOView)

    the view into the current Mach-O

  • ntools (Integer)

    the number of tools



1215
1216
1217
1218
1219
1220
1221
# File 'lib/macho/load_commands.rb', line 1215

def initialize(view, ntools)
  format = Utils.specialize_format("L=#{ntools * 2}", view.endianness)
  raw_table = view.raw_data[view.offset + 24, ntools * 8]
  blobs = raw_table.unpack(format).each_slice(2).to_a

  @tools = blobs.map { |b| Tool.new(*b) }
end

Instance Attribute Details

#toolsArray<Tool> (readonly)

Returns all tools.

Returns:

  • (Array<Tool>)

    all tools



1210
1211
1212
# File 'lib/macho/load_commands.rb', line 1210

def tools
  @tools
end