Class: MachO::LoadCommands::BuildVersionCommand
- Inherits:
-
LoadCommand
- Object
- MachOStructure
- LoadCommand
- MachO::LoadCommands::BuildVersionCommand
- Defined in:
- lib/macho/load_commands.rb
Overview
A load command containing the minimum OS version on which the binary was built for its platform. Corresponds to LC_BUILD_VERSION.
Defined Under Namespace
Classes: ToolEntries
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=6".freeze
- 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.
24
Instance Attribute Summary collapse
-
#minos ⇒ Integer
readonly
The minimum OS version X.Y.Z packed as x16.y8.z8.
- #platform ⇒ Integer readonly
-
#sdk ⇒ Integer
readonly
The SDK version X.Y.Z packed as x16.y8.z8.
-
#tool_entries ⇒ ToolEntries
readonly
Tool entries.
Attributes inherited from LoadCommand
Instance Method Summary collapse
-
#initialize(view, cmd, cmdsize, platform, minos, sdk, ntools) ⇒ BuildVersionCommand
constructor
private
A new instance of BuildVersionCommand.
-
#minos_string ⇒ String
A string representation of the binary's minimum OS version.
-
#sdk_string ⇒ String
A string representation of the binary's SDK version.
-
#to_h ⇒ Hash
A hash representation of this BuildVersionCommand.
Methods inherited from LoadCommand
create, new_from_bin, #offset, #serializable?, #serialize, #to_s, #type
Methods inherited from MachOStructure
Constructor Details
#initialize(view, cmd, cmdsize, platform, minos, sdk, ntools) ⇒ BuildVersionCommand
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 BuildVersionCommand.
1375 1376 1377 1378 1379 1380 1381 |
# File 'lib/macho/load_commands.rb', line 1375 def initialize(view, cmd, cmdsize, platform, minos, sdk, ntools) super(view, cmd, cmdsize) @platform = platform @minos = minos @sdk = sdk @tool_entries = ToolEntries.new(view, ntools) end |
Instance Attribute Details
#minos ⇒ Integer (readonly)
Returns the minimum OS version X.Y.Z packed as x16.y8.z8.
1358 1359 1360 |
# File 'lib/macho/load_commands.rb', line 1358 def minos @minos end |
#platform ⇒ Integer (readonly)
1355 1356 1357 |
# File 'lib/macho/load_commands.rb', line 1355 def platform @platform end |
#sdk ⇒ Integer (readonly)
Returns the SDK version X.Y.Z packed as x16.y8.z8.
1361 1362 1363 |
# File 'lib/macho/load_commands.rb', line 1361 def sdk @sdk end |
#tool_entries ⇒ ToolEntries (readonly)
Returns tool entries.
1364 1365 1366 |
# File 'lib/macho/load_commands.rb', line 1364 def tool_entries @tool_entries end |
Instance Method Details
#minos_string ⇒ String
A string representation of the binary's minimum OS version.
1385 1386 1387 1388 1389 1390 1391 1392 |
# File 'lib/macho/load_commands.rb', line 1385 def minos_string binary = "%032b" % minos segs = [ binary[0..15], binary[16..23], binary[24..31] ].map { |s| s.to_i(2) } segs.join(".") end |
#sdk_string ⇒ String
A string representation of the binary's SDK version.
1396 1397 1398 1399 1400 1401 1402 1403 |
# File 'lib/macho/load_commands.rb', line 1396 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 |
#to_h ⇒ Hash
Returns a hash representation of this MachO::LoadCommands::BuildVersionCommand.
1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 |
# File 'lib/macho/load_commands.rb', line 1406 def to_h { "platform" => platform, "minos" => minos, "minos_string" => minos_string, "sdk" => sdk, "sdk_string" => sdk_string, "tool_entries" => tool_entries.tools.map(&:to_h), }.merge super end |