Class: MachO::LoadCommand::LCStr

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

Overview

Represents a Load Command string. A rough analogue to the lc_str struct used internally by OS X. This class allows ruby-macho to pretend that strings stored in LCs are immediately available without explicit operations on the raw Mach-O data.

Instance Method Summary collapse

Constructor Details

#initialize(raw_data, lc, lc_str) ⇒ LCStr

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



336
337
338
339
340
341
# File 'lib/macho/load_commands.rb', line 336

def initialize(raw_data, lc, lc_str)
  @raw_data = raw_data
  @lc = lc
  @lc_str = lc_str
  @str = @raw_data.slice(@lc.offset + @lc_str...@lc.offset + @lc.cmdsize).delete("\x00")
end

Instance Method Details

#to_iFixnum



349
350
351
# File 'lib/macho/load_commands.rb', line 349

def to_i
  @lc_str
end

#to_sString



344
345
346
# File 'lib/macho/load_commands.rb', line 344

def to_s
  @str
end