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. 
- "".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. 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.
| 16 17 18 | # File 'lib/macho/structure.rb', line 16 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.
| 24 25 26 27 28 | # File 'lib/macho/structure.rb', line 24 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.
| 31 32 33 34 35 36 37 38 | # File 'lib/macho/structure.rb', line 31 def to_h { "structure" => { "format" => self.class::FORMAT, "bytesize" => self.class.bytesize, }, } end |