Class: MachO::LoadCommand::LCStr
- Inherits:
-
Object
- Object
- MachO::LoadCommand::LCStr
- 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
-
#initialize(raw_data, lc, lc_str) ⇒ LCStr
constructor
private
A new instance of LCStr.
-
#to_i ⇒ Fixnum
The offset to the beginning of the string in the load command.
-
#to_s ⇒ String
A string representation of the LCStr.
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.
190 191 192 193 194 195 |
# File 'lib/macho/load_commands.rb', line 190 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_i ⇒ Fixnum
Returns the offset to the beginning of the string in the load command.
203 204 205 |
# File 'lib/macho/load_commands.rb', line 203 def to_i @lc_str end |
#to_s ⇒ String
Returns a string representation of the LCStr.
198 199 200 |
# File 'lib/macho/load_commands.rb', line 198 def to_s @str end |