Class: MachO::LoadCommands::SourceVersionCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::LoadCommands::SourceVersionCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
A load command specifying the version of the sources used to build the binary. Corresponds to LC_SOURCE_VERSION.
Instance Method Summary collapse
-
#to_h ⇒ Hash
A hash representation of this SourceVersionCommand.
-
#version ⇒ Integer
The version packed as a24.b10.c10.d10.e10.
-
#version_string ⇒ String
A string representation of the sources used to build the binary.
Methods inherited from LoadCommand
#cmd, #cmdsize, create, new_from_bin, #offset, #serializable?, #serialize, #to_s, #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::SourceVersionCommand.
1351 1352 1353 1354 1355 1356 |
# File 'lib/macho/load_commands.rb', line 1351 def to_h { "version" => version, "version_string" => version_string, }.merge super end |
#version ⇒ Integer
Returns the version packed as a24.b10.c10.d10.e10.
1336 |
# File 'lib/macho/load_commands.rb', line 1336 field :version, :uint64 |
#version_string ⇒ String
A string representation of the sources used to build the binary.
1340 1341 1342 1343 1344 1345 1346 1347 1348 |
# File 'lib/macho/load_commands.rb', line 1340 def version_string binary = "%064<version>b" % { :version => version } segs = [ binary[0..23], binary[24..33], binary[34..43], binary[44..53], binary[54..63] ].map { |s| s.to_i(2) } segs.join(".") end |