Class: MachO::Headers::FatHeader
- Inherits:
-
MachOStructure
- Object
- MachOStructure
- MachO::Headers::FatHeader
- Defined in:
- lib/macho/headers.rb
Overview
Fat binary header structure
Constant Summary collapse
- FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
always big-endian
"N2"
- SIZEOF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
8
Instance Attribute Summary collapse
-
#magic ⇒ Integer
readonly
The magic number of the header (and file).
-
#nfat_arch ⇒ Integer
readonly
The number of fat architecture structures following the header.
Instance Method Summary collapse
-
#initialize(magic, nfat_arch) ⇒ FatHeader
constructor
private
A new instance of FatHeader.
-
#serialize ⇒ String
The serialized fields of the fat header.
-
#to_h ⇒ Hash
A hash representation of this FatHeader.
Methods inherited from MachOStructure
Constructor Details
#initialize(magic, nfat_arch) ⇒ FatHeader
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 FatHeader.
523 524 525 526 527 |
# File 'lib/macho/headers.rb', line 523 def initialize(magic, nfat_arch) super() @magic = magic @nfat_arch = nfat_arch end |
Instance Attribute Details
#magic ⇒ Integer (readonly)
Returns the magic number of the header (and file).
508 509 510 |
# File 'lib/macho/headers.rb', line 508 def magic @magic end |
#nfat_arch ⇒ Integer (readonly)
Returns the number of fat architecture structures following the header.
511 512 513 |
# File 'lib/macho/headers.rb', line 511 def nfat_arch @nfat_arch end |
Instance Method Details
#serialize ⇒ String
Returns the serialized fields of the fat header.
530 531 532 |
# File 'lib/macho/headers.rb', line 530 def serialize [magic, nfat_arch].pack(FORMAT) end |
#to_h ⇒ Hash
Returns a hash representation of this MachO::Headers::FatHeader.
535 536 537 538 539 540 541 |
# File 'lib/macho/headers.rb', line 535 def to_h { "magic" => magic, "magic_sym" => MH_MAGICS[magic], "nfat_arch" => nfat_arch, }.merge super end |