Class: MachO::VersionMinCommand

Inherits:
LoadCommand show all
Defined in:
lib/macho/load_commands.rb

Overview

A load command containing the minimum OS version on which the binary was built to run. Corresponds to LC_VERSION_MIN_MACOSX and LC_VERSION_MIN_IPHONEOS.

Constant Summary collapse

FORMAT =
"VVVV"
SIZEOF =
16

Instance Attribute Summary collapse

Attributes inherited from LoadCommand

#cmd, #cmdsize, #offset

Instance Method Summary collapse

Methods inherited from LoadCommand

new_from_bin, #to_s

Methods inherited from MachOStructure

bytesize, new_from_bin

Constructor Details

#initialize(raw_data, offset, cmd, cmdsize, version, sdk) ⇒ VersionMinCommand

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 VersionMinCommand.



981
982
983
984
985
# File 'lib/macho/load_commands.rb', line 981

def initialize(raw_data, offset, cmd, cmdsize, version, sdk)
	super(raw_data, offset, cmd, cmdsize)
	@version = version
	@sdk = sdk
end

Instance Attribute Details

#sdkFixnum (readonly)

Returns the SDK version X.Y.Z packed as x16.y8.z8.

Returns:

  • (Fixnum)

    the SDK version X.Y.Z packed as x16.y8.z8



975
976
977
# File 'lib/macho/load_commands.rb', line 975

def sdk
  @sdk
end

#versionFixnum (readonly)

Returns the version X.Y.Z packed as x16.y8.z8.

Returns:

  • (Fixnum)

    the version X.Y.Z packed as x16.y8.z8



972
973
974
# File 'lib/macho/load_commands.rb', line 972

def version
  @version
end

Instance Method Details

#sdk_stringString

A string representation of the binary's SDK version.

Returns:

  • (String)

    a string representing the SDK version.



1000
1001
1002
1003
1004
1005
1006
1007
# File 'lib/macho/load_commands.rb', line 1000

def sdk_string
	binary = "%032b" % sdk
	segs = [
		binary[0..15], binary[16..23], binary[24..31]
	].map { |s| s.to_i(2) }

	segs.join(".")
end

#version_stringString

A string representation of the binary's minimum OS version.

Returns:

  • (String)

    a string representing the minimum OS version.



989
990
991
992
993
994
995
996
# File 'lib/macho/load_commands.rb', line 989

def version_string
	binary = "%032b" % version
	segs = [
		binary[0..15], binary[16..23], binary[24..31]
	].map { |s| s.to_i(2) }

	segs.join(".")
end