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.
Instance Method Summary collapse
-
#to_h ⇒ Hash
Returns a hash representation of this UUIDCommand.
-
#to_s ⇒ String
An alias for uuid_string.
-
#uuid ⇒ Array<Integer>
The UUID.
-
#uuid_string ⇒ String
A string representation of the UUID.
Methods inherited from LoadCommand
#cmd, #cmdsize, create, new_from_bin, #offset, #serializable?, #serialize, #type, #view
Methods inherited from MachOStructure
bytesize, format, #initialize, new_from_bin
Constructor Details
This class inherits a constructor from MachO::MachOStructure
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::UUIDCommand
389 390 391 392 393 394 |
# File 'lib/macho/load_commands.rb', line 389 def to_h { "uuid" => uuid, "uuid_string" => uuid_string, }.merge super end |
#to_s ⇒ String
Returns an alias for uuid_string.
384 385 386 |
# File 'lib/macho/load_commands.rb', line 384 def to_s uuid_string end |
#uuid ⇒ Array<Integer>
Returns the UUID.
370 |
# File 'lib/macho/load_commands.rb', line 370 field :uuid, :string, :size => 16, :unpack => "C16" |
#uuid_string ⇒ String
Returns a string representation of the UUID.
373 374 375 376 377 378 379 380 381 |
# File 'lib/macho/load_commands.rb', line 373 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 |