Class: MachO::MachOStructure Abstract
- Inherits:
-
Object
- Object
- MachO::MachOStructure
- Defined in:
- lib/macho/structure.rb
Overview
A general purpose pseudo-structure.
Direct Known Subclasses
Headers::FatArch, Headers::FatHeader, Headers::MachHeader, LoadCommands::LoadCommand, Sections::Section
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.
The String#unpack format of the data structure.
""
- 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.
The size of the data structure, in bytes.
0
Class Method Summary collapse
-
.bytesize ⇒ Integer
The size, in bytes, of the represented structure.
-
.new_from_bin(endianness, bin) ⇒ MachO::MachOStructure
private
The resulting structure.
Instance Method Summary collapse
-
#to_h ⇒ Hash
A hash representation of this MachOStructure.
Class Method Details
.bytesize ⇒ Integer
Returns the size, in bytes, of the represented structure.
18 19 20 |
# File 'lib/macho/structure.rb', line 18 def self.bytesize self::SIZEOF end |
.new_from_bin(endianness, bin) ⇒ MachO::MachOStructure
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 the resulting structure.
26 27 28 29 30 |
# File 'lib/macho/structure.rb', line 26 def self.new_from_bin(endianness, bin) format = Utils.specialize_format(self::FORMAT, endianness) new(*bin.unpack(format)) end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of this MachO::MachOStructure.
33 34 35 36 37 38 39 40 |
# File 'lib/macho/structure.rb', line 33 def to_h { "structure" => { "format" => self.class::FORMAT, "bytesize" => self.class.bytesize, }, } end |