Class: MachO::Headers::FatArch
- Inherits:
-
MachOStructure
- Object
- MachOStructure
- MachO::Headers::FatArch
- Defined in:
- lib/macho/headers.rb
Overview
Fat binary header architecture structure. A Fat binary has one or more of these, representing one or more internal Mach-O blobs.
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
"N5".freeze
- 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.
20
Instance Attribute Summary collapse
-
#align ⇒ Integer
readonly
The alignment, as a power of 2.
-
#cpusubtype ⇒ Integer
readonly
The CPU subtype of the Mach-O.
-
#cputype ⇒ Integer
readonly
The CPU type of the Mach-O.
-
#offset ⇒ Integer
readonly
The file offset to the beginning of the Mach-O data.
-
#size ⇒ Integer
readonly
The size, in bytes, of the Mach-O data.
Instance Method Summary collapse
-
#initialize(cputype, cpusubtype, offset, size, align) ⇒ FatArch
constructor
private
A new instance of FatArch.
-
#serialize ⇒ String
The serialized fields of the fat arch.
-
#to_h ⇒ Hash
A hash representation of this FatArch.
Methods inherited from MachOStructure
Constructor Details
#initialize(cputype, cpusubtype, offset, size, align) ⇒ FatArch
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 FatArch.
518 519 520 521 522 523 524 |
# File 'lib/macho/headers.rb', line 518 def initialize(cputype, cpusubtype, offset, size, align) @cputype = cputype @cpusubtype = cpusubtype & ~CPU_SUBTYPE_MASK @offset = offset @size = size @align = align end |
Instance Attribute Details
#align ⇒ Integer (readonly)
Returns the alignment, as a power of 2.
506 507 508 |
# File 'lib/macho/headers.rb', line 506 def align @align end |
#cpusubtype ⇒ Integer (readonly)
Returns the CPU subtype of the Mach-O.
497 498 499 |
# File 'lib/macho/headers.rb', line 497 def cpusubtype @cpusubtype end |
#cputype ⇒ Integer (readonly)
Returns the CPU type of the Mach-O.
494 495 496 |
# File 'lib/macho/headers.rb', line 494 def cputype @cputype end |
#offset ⇒ Integer (readonly)
Returns the file offset to the beginning of the Mach-O data.
500 501 502 |
# File 'lib/macho/headers.rb', line 500 def offset @offset end |
#size ⇒ Integer (readonly)
Returns the size, in bytes, of the Mach-O data.
503 504 505 |
# File 'lib/macho/headers.rb', line 503 def size @size end |
Instance Method Details
#serialize ⇒ String
Returns the serialized fields of the fat arch.
527 528 529 |
# File 'lib/macho/headers.rb', line 527 def serialize [cputype, cpusubtype, offset, size, align].pack(FORMAT) end |
#to_h ⇒ Hash
Returns a hash representation of this MachO::Headers::FatArch.
532 533 534 535 536 537 538 539 540 541 542 |
# File 'lib/macho/headers.rb', line 532 def to_h { "cputype" => cputype, "cputype_sym" => CPU_TYPES[cputype], "cpusubtype" => cpusubtype, "cpusubtype_sym" => CPU_SUBTYPES[cputype][cpusubtype], "offset" => offset, "size" => size, "align" => align, }.merge super end |