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



1434
1435
1436
1437
1438
1439
1440
# File 'lib/macho/load_commands.rb', line 1434

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



1429
1430
1431
# File 'lib/macho/load_commands.rb', line 1429

def tools
  @tools
end