Class: MachO::UUIDCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::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 Attribute Summary collapse
-
#uuid ⇒ Array<Fixnum>
readonly
The UUID.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(offset, cmd, cmdsize, uuid) ⇒ UUIDCommand
constructor
A new instance of UUIDCommand.
-
#uuid_string ⇒ String
A string representation of the UUID.
Methods inherited from LoadCommand
Methods inherited from MachOStructure
Constructor Details
#initialize(offset, cmd, cmdsize, uuid) ⇒ UUIDCommand
Returns a new instance of UUIDCommand.
337 338 339 340 |
# File 'lib/macho/load_commands.rb', line 337 def initialize(offset, cmd, cmdsize, uuid) super(offset, cmd, cmdsize) @uuid = uuid.unpack("C16") # re-unpack for the actual UUID array end |
Instance Attribute Details
#uuid ⇒ Array<Fixnum> (readonly)
Returns the UUID.
331 332 333 |
# File 'lib/macho/load_commands.rb', line 331 def uuid @uuid end |
Instance Method Details
#uuid_string ⇒ String
Returns a string representation of the UUID.
343 344 345 346 347 348 349 350 351 |
# File 'lib/macho/load_commands.rb', line 343 def uuid_string hexes = uuid.map { |e| "%02x" % e } segs = [ hexes[0..3].join, hexes[4..5].join, hexes[6..7].join, hexes[8..9].join, hexes[10..15].join ] segs.join("-") end |