Class: MachO::Headers::FatHeader

Inherits:
MachOStructure show all
Defined in:
lib/macho/headers.rb

Overview

Fat binary header structure

See Also:

  • FatArch

Instance Method Summary collapse

Methods inherited from MachOStructure

bytesize, format, #initialize, new_from_bin

Constructor Details

This class inherits a constructor from MachO::MachOStructure

Instance Method Details

#magicInteger

Returns the magic number of the header (and file).

Returns:

  • (Integer)

    the magic number of the header (and file)



508
# File 'lib/macho/headers.rb', line 508

field :magic, :uint32, :endian => :big

#nfat_archInteger

Returns the number of fat architecture structures following the header.

Returns:

  • (Integer)

    the number of fat architecture structures following the header



511
# File 'lib/macho/headers.rb', line 511

field :nfat_arch, :uint32, :endian => :big

#serializeString

Returns the serialized fields of the fat header.

Returns:

  • (String)

    the serialized fields of the fat header



514
515
516
# File 'lib/macho/headers.rb', line 514

def serialize
  [magic, nfat_arch].pack(self.class.format)
end

#to_hHash

Returns a hash representation of this MachO::Headers::FatHeader.

Returns:



519
520
521
522
523
524
525
# File 'lib/macho/headers.rb', line 519

def to_h
  {
    "magic" => magic,
    "magic_sym" => MH_MAGICS[magic],
    "nfat_arch" => nfat_arch,
  }.merge super
end