Class: MachO::MachOView
- Inherits:
-
Object
- Object
- MachO::MachOView
- Defined in:
- lib/macho/view.rb
Overview
A representation of some unspecified Mach-O data.
Instance Attribute Summary collapse
-
#endianness ⇒ Symbol
readonly
The endianness of the data (
:big
or:little
). -
#macho_file ⇒ MachOFile
readonly
That this view belongs to.
-
#offset ⇒ Integer
readonly
The offset of the relevant data (in #raw_data).
-
#raw_data ⇒ String
readonly
The raw Mach-O data.
Instance Method Summary collapse
-
#initialize(macho_file, raw_data, endianness, offset) ⇒ MachOView
constructor
Creates a new MachOView.
- #inspect ⇒ Object
-
#to_h ⇒ Hash
A hash representation of this MachOView.
Constructor Details
#initialize(macho_file, raw_data, endianness, offset) ⇒ MachOView
Creates a new MachOView.
23 24 25 26 27 28 |
# File 'lib/macho/view.rb', line 23 def initialize(macho_file, raw_data, endianness, offset) @macho_file = macho_file @raw_data = raw_data @endianness = endianness @offset = offset end |
Instance Attribute Details
#endianness ⇒ Symbol (readonly)
Returns the endianness of the data (:big
or :little
).
13 14 15 |
# File 'lib/macho/view.rb', line 13 def endianness @endianness end |
#macho_file ⇒ MachOFile (readonly)
Returns that this view belongs to.
7 8 9 |
# File 'lib/macho/view.rb', line 7 def macho_file @macho_file end |
#offset ⇒ Integer (readonly)
Returns the offset of the relevant data (in #raw_data).
16 17 18 |
# File 'lib/macho/view.rb', line 16 def offset @offset end |
#raw_data ⇒ String (readonly)
Returns the raw Mach-O data.
10 11 12 |
# File 'lib/macho/view.rb', line 10 def raw_data @raw_data end |
Instance Method Details
#inspect ⇒ Object
38 39 40 |
# File 'lib/macho/view.rb', line 38 def inspect "#<#{self.class}:0x#{(object_id << 1).to_s(16)} @endianness=#{@endianness.inspect}, @offset=#{@offset.inspect}, length=#{@raw_data.length}>" end |
#to_h ⇒ Hash
Returns a hash representation of this MachO::MachOView.
31 32 33 34 35 36 |
# File 'lib/macho/view.rb', line 31 def to_h { "endianness" => endianness, "offset" => offset, } end |