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.
Constant Summary collapse
- FORMAT =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
"L=2Q=1"
- SIZEOF =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
16
Instance Attribute Summary collapse
-
#version ⇒ Integer
readonly
The version packed as a24.b10.c10.d10.e10.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(view, cmd, cmdsize, version) ⇒ SourceVersionCommand
constructor
private
A new instance of SourceVersionCommand.
-
#to_h ⇒ Hash
A hash representation of this SourceVersionCommand.
-
#version_string ⇒ String
A string representation of the sources used to build the binary.
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #serialize, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, version) ⇒ SourceVersionCommand
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of SourceVersionCommand.
1620 1621 1622 1623 |
# File 'lib/macho/load_commands.rb', line 1620 def initialize(view, cmd, cmdsize, version) super(view, cmd, cmdsize) @version = version end |
Instance Attribute Details
#version ⇒ Integer (readonly)
Returns the version packed as a24.b10.c10.d10.e10.
1609 1610 1611 |
# File 'lib/macho/load_commands.rb', line 1609 def version @version end |
Instance Method Details
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::SourceVersionCommand.
1638 1639 1640 1641 1642 1643 |
# File 'lib/macho/load_commands.rb', line 1638 def to_h { "version" => version, "version_string" => version_string, }.merge super end |
#version_string ⇒ String
A string representation of the sources used to build the binary.
1627 1628 1629 1630 1631 1632 1633 1634 1635 |
# File 'lib/macho/load_commands.rb', line 1627 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 |