class MachO::LoadCommands::SourceVersionCommand

A load command specifying the version of the sources used to build the binary. Corresponds to LC_SOURCE_VERSION.

Public Instance Methods

to_h() click to toggle source

@return [Hash] a hash representation of this {SourceVersionCommand}

Calls superclass method MachO::LoadCommands::LoadCommand#to_h
# File lib/macho/load_commands.rb, line 1351
def to_h
  {
    "version" => version,
    "version_string" => version_string,
  }.merge super
end
version_string() click to toggle source

A string representation of the sources used to build the binary. @return [String] a string representation of the version

# 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