Class: MachO::LoadCommands::UUIDCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::LoadCommands::UUIDCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
A load command containing a single 128-bit unique random number identifying an object produced by static link editor. Corresponds to LC_UUID.
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=2a16"
- 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.
24
Instance Attribute Summary collapse
-
#uuid ⇒ Array<Integer>
readonly
The UUID.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(view, cmd, cmdsize, uuid) ⇒ UUIDCommand
constructor
private
A new instance of UUIDCommand.
-
#to_h ⇒ Hash
Returns a hash representation of this UUIDCommand.
-
#uuid_string ⇒ String
A string representation of the UUID.
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #serialize, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, uuid) ⇒ UUIDCommand
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 UUIDCommand.
382 383 384 385 |
# File 'lib/macho/load_commands.rb', line 382 def initialize(view, cmd, cmdsize, uuid) super(view, cmd, cmdsize) @uuid = uuid.unpack("C16") # re-unpack for the actual UUID array end |
Instance Attribute Details
#uuid ⇒ Array<Integer> (readonly)
Returns the UUID.
371 372 373 |
# File 'lib/macho/load_commands.rb', line 371 def uuid @uuid end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::UUIDCommand
399 400 401 402 403 404 |
# File 'lib/macho/load_commands.rb', line 399 def to_h { "uuid" => uuid, "uuid_string" => uuid_string, }.merge super end |
#uuid_string ⇒ String
Returns a string representation of the UUID.
388 389 390 391 392 393 394 395 396 |
# File 'lib/macho/load_commands.rb', line 388 def uuid_string hexes = uuid.map { |elem| "%02<elem>x" % { :elem => elem } } segs = [ hexes[0..3].join, hexes[4..5].join, hexes[6..7].join, hexes[8..9].join, hexes[10..15].join ] segs.join("-") end |