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)



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

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



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

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

#serializeString

Returns the serialized fields of the fat header.

Returns:

  • (String)

    the serialized fields of the fat header



526
527
528
# File 'lib/macho/headers.rb', line 526

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

#to_hHash

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

Returns:



531
532
533
534
535
536
537
# File 'lib/macho/headers.rb', line 531

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