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.
1161 1162 1163 1164 |
# File 'lib/macho/load_commands.rb', line 1161 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.
1150 1151 1152 |
# File 'lib/macho/load_commands.rb', line 1150 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.
1169 1170 1171 1172 1173 1174 1175 1176 |
# File 'lib/macho/load_commands.rb', line 1169 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.
1179 1180 1181 1182 1183 |
# File 'lib/macho/load_commands.rb', line 1179 def to_h { "path" => path.to_h, }.merge super end |