Class: MachO::LoadCommands::DylinkerCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::LoadCommands::DylinkerCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
A load command representing some aspect of the dynamic linker, depending on filetype. Corresponds to LC_ID_DYLINKER, LC_LOAD_DYLINKER, and LC_DYLD_ENVIRONMENT.
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
-
#name ⇒ LCStr
readonly
The dynamic linker's path name as an LCStr.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(view, cmd, cmdsize, name) ⇒ DylinkerCommand
constructor
private
A new instance of DylinkerCommand.
-
#serialize(context) ⇒ String
private
The serialized fields of the load command.
-
#to_h ⇒ Hash
A hash representation of this DylinkerCommand.
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, name) ⇒ DylinkerCommand
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 DylinkerCommand.
611 612 613 614 |
# File 'lib/macho/load_commands.rb', line 611 def initialize(view, cmd, cmdsize, name) super(view, cmd, cmdsize) @name = LCStr.new(self, name) end |
Instance Attribute Details
#name ⇒ LCStr (readonly)
Returns the dynamic linker's path name as an LCStr.
600 601 602 |
# File 'lib/macho/load_commands.rb', line 600 def name @name 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.
620 621 622 623 624 625 626 627 |
# File 'lib/macho/load_commands.rb', line 620 def serialize(context) format = Utils.specialize_format(FORMAT, context.endianness) string_payload, string_offsets = Utils.pack_strings(SIZEOF, context.alignment, :name => name.to_s) cmdsize = SIZEOF + string_payload.bytesize [cmd, cmdsize, string_offsets[:name]].pack(format) + string_payload end |
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::DylinkerCommand.
630 631 632 633 634 |
# File 'lib/macho/load_commands.rb', line 630 def to_h { "name" => name.to_h, }.merge super end |