Class: MachO::LoadCommands::RpathCommand
- Inherits:
- 
      LoadCommand
      
        - Object
- MachOStructure
- LoadCommand
- MachO::LoadCommands::RpathCommand
 
- Defined in:
- lib/macho/load_commands.rb
Overview
A load command representing an rpath, which specifies a path that should be added to the current run path used to find @rpath prefixed dylibs. Corresponds to LC_RPATH.
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. 
- "L=3".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. 
- 12
Instance Attribute Summary collapse
- 
  
    
      #path  ⇒ LCStr 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    The path to add to the run path as an LCStr. 
Attributes inherited from LoadCommand
Instance Method Summary collapse
- 
  
    
      #initialize(view, cmd, cmdsize, path)  ⇒ RpathCommand 
    
    
  
  
  
    constructor
  
  
  
  
  
  private
  
    A new instance of RpathCommand. 
- 
  
    
      #serialize(context)  ⇒ String 
    
    
  
  
  
  
  
  
  
  private
  
    The serialized fields of the load command. 
- 
  
    
      #to_h  ⇒ Hash 
    
    
  
  
  
  
  
  
  
  
  
    A hash representation of this RpathCommand. 
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, path) ⇒ RpathCommand
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 RpathCommand.
| 1166 1167 1168 1169 | # File 'lib/macho/load_commands.rb', line 1166 def initialize(view, cmd, cmdsize, path) super(view, cmd, cmdsize) @path = LCStr.new(self, path) end | 
Instance Attribute Details
#path ⇒ LCStr (readonly)
Returns the path to add to the run path as an LCStr.
| 1155 1156 1157 | # File 'lib/macho/load_commands.rb', line 1155 def path @path end | 
Instance Method Details
#serialize(context) ⇒ String
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 serialized fields of the load command.
| 1174 1175 1176 1177 1178 1179 1180 1181 | # File 'lib/macho/load_commands.rb', line 1174 def serialize(context) format = Utils.specialize_format(FORMAT, context.endianness) string_payload, string_offsets = Utils.pack_strings(SIZEOF, context.alignment, :path => path.to_s) cmdsize = SIZEOF + string_payload.bytesize [cmd, cmdsize, string_offsets[:path]].pack(format) + string_payload end | 
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::RpathCommand.
| 1184 1185 1186 1187 1188 | # File 'lib/macho/load_commands.rb', line 1184 def to_h { "path" => path.to_h, }.merge super end |