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
412 413 414 415 416 417 |
# File 'lib/macho/load_commands.rb', line 412 def to_h { "uuid" => uuid, "uuid_string" => uuid_string, }.merge super end |
#to_s ⇒ String
Returns an alias for uuid_string.
407 408 409 |
# File 'lib/macho/load_commands.rb', line 407 def to_s uuid_string end |
#uuid ⇒ Array<Integer>
Returns the UUID.
393 |
# File 'lib/macho/load_commands.rb', line 393 field :uuid, :string, :size => 16, :unpack => "C16" |
#uuid_string ⇒ String
Returns a string representation of the UUID.
396 397 398 399 400 401 402 403 404 |
# File 'lib/macho/load_commands.rb', line 396 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 |