Class: MachO::LoadCommand

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

Overview

Mach-O load command structure this is the most generic load command - only cmd ID and size are represented, and no actual data. used when a more specific class isn’t available/implemented

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from MachOStructure

bytesize

Constructor Details

#initialize(offset, cmd, cmdsize) ⇒ LoadCommand

Returns a new instance of LoadCommand.



169
170
171
172
173
# File 'lib/macho/load_commands.rb', line 169

def initialize(offset, cmd, cmdsize)
	@offset = offset
	@cmd = cmd
	@cmdsize = cmdsize
end

Instance Attribute Details

#cmdObject (readonly)

Returns the value of attribute cmd.



160
161
162
# File 'lib/macho/load_commands.rb', line 160

def cmd
  @cmd
end

#cmdsizeObject (readonly)

Returns the value of attribute cmdsize.



160
161
162
# File 'lib/macho/load_commands.rb', line 160

def cmdsize
  @cmdsize
end

#offsetObject (readonly)

Returns the value of attribute offset.



160
161
162
# File 'lib/macho/load_commands.rb', line 160

def offset
  @offset
end

Class Method Details

.new_from_bin(offset, bin) ⇒ Object



165
166
167
# File 'lib/macho/load_commands.rb', line 165

def self.new_from_bin(offset, bin)
	self.new(offset, *bin.unpack(@format))
end

Instance Method Details

#to_sObject



175
176
177
# File 'lib/macho/load_commands.rb', line 175

def to_s
	LOAD_COMMANDS[cmd]
end