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.
200 201 202 203 204 205 |
# File 'lib/macho/load_commands.rb', line 200 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.
213 214 215 |
# File 'lib/macho/load_commands.rb', line 213 def to_i @lc_str end |
#to_s ⇒ String
Returns a string representation of the LCStr.
208 209 210 |
# File 'lib/macho/load_commands.rb', line 208 def to_s @str end |