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.
1252 1253 1254 1255 1256 1257 |
# File 'lib/macho/load_commands.rb', line 1252 def to_h { "version" => version, "version_string" => version_string, }.merge super end |
#version ⇒ Integer
Returns the version packed as a24.b10.c10.d10.e10.
1237 |
# File 'lib/macho/load_commands.rb', line 1237 field :version, :uint64 |
#version_string ⇒ String
A string representation of the sources used to build the binary.
1241 1242 1243 1244 1245 1246 1247 1248 1249 |
# File 'lib/macho/load_commands.rb', line 1241 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 |