Class: MachO::SourceVersionCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::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 Attribute Summary collapse
-
#version ⇒ Fixnum
readonly
The version packed as a24.b10.c10.d10.e10.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(offset, cmd, cmdsize, version) ⇒ SourceVersionCommand
constructor
A new instance of SourceVersionCommand.
-
#version_string ⇒ String
A string representation of the sources used to build the binary.
Methods inherited from LoadCommand
Methods inherited from MachOStructure
Constructor Details
#initialize(offset, cmd, cmdsize, version) ⇒ SourceVersionCommand
Returns a new instance of SourceVersionCommand.
1082 1083 1084 1085 |
# File 'lib/macho/load_commands.rb', line 1082 def initialize(offset, cmd, cmdsize, version) super(offset, cmd, cmdsize) @version = version end |
Instance Attribute Details
#version ⇒ Fixnum (readonly)
Returns the version packed as a24.b10.c10.d10.e10.
1076 1077 1078 |
# File 'lib/macho/load_commands.rb', line 1076 def version @version end |
Instance Method Details
#version_string ⇒ String
A string representation of the sources used to build the binary.
1089 1090 1091 1092 1093 1094 1095 1096 1097 |
# File 'lib/macho/load_commands.rb', line 1089 def version_string binary = "%064b" % 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 |