Class: MachO::MachOView

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

Overview

A representation of some unspecified Mach-O data.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_data, endianness, offset) ⇒ MachOView

Creates a new MachOView.

Parameters:

  • raw_data (String)

    the raw Mach-O data

  • endianness (Symbol)

    the endianness of the data

  • offset (Integer)

    the offset of the relevant data



17
18
19
20
21
# File 'lib/macho/view.rb', line 17

def initialize(raw_data, endianness, offset)
  @raw_data = raw_data
  @endianness = endianness
  @offset = offset
end

Instance Attribute Details

#endiannessSymbol (readonly)

Returns the endianness of the data (:big or :little).

Returns:

  • (Symbol)

    the endianness of the data (:big or :little)



8
9
10
# File 'lib/macho/view.rb', line 8

def endianness
  @endianness
end

#offsetInteger (readonly)

Returns the offset of the relevant data (in #raw_data).

Returns:

  • (Integer)

    the offset of the relevant data (in #raw_data)



11
12
13
# File 'lib/macho/view.rb', line 11

def offset
  @offset
end

#raw_dataString (readonly)

Returns the raw Mach-O data.

Returns:

  • (String)

    the raw Mach-O data



5
6
7
# File 'lib/macho/view.rb', line 5

def raw_data
  @raw_data
end

Instance Method Details

#to_hHash

Returns a hash representation of this MachO::MachOView.

Returns:



24
25
26
27
28
29
# File 'lib/macho/view.rb', line 24

def to_h
  {
    "endianness" => endianness,
    "offset" => offset,
  }
end