class MachO::MachOView

A representation of some unspecified Mach-O data.

Attributes

endianness[R]

@return [Symbol] the endianness of the data (‘:big` or `:little`)

macho_file[R]

@return [MachOFile] that this view belongs to

offset[R]

@return [Integer] the offset of the relevant data (in {#raw_data})

raw_data[R]

@return [String] the raw Mach-O data

Public Class Methods

new(macho_file, raw_data, endianness, offset) click to toggle source

Creates a new MachOView. @param macho_file [MachOFile] the file this view slice is from @param raw_data [String] the raw Mach-O data @param endianness [Symbol] the endianness of the data @param offset [Integer] the offset of the relevant data

# 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

Public Instance Methods

inspect() click to toggle source
# 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() click to toggle source

@return [Hash] a hash representation of this {MachOView}.

# File lib/macho/view.rb, line 31
def to_h
  {
    "endianness" => endianness,
    "offset" => offset,
  }
end