Class: MachO::LoadCommands::LoadCommand::SerializationContext

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

Overview

Represents the contextual information needed by a load command to serialize itself correctly into a binary string.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(endianness, alignment) ⇒ SerializationContext

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 SerializationContext.

Parameters:

  • endianness (Symbol)

    the endianness of the context

  • alignment (Fixnum)

    the alignment of the context



313
314
315
316
# File 'lib/macho/load_commands.rb', line 313

def initialize(endianness, alignment)
  @endianness = endianness
  @alignment = alignment
end

Instance Attribute Details

#alignmentFixnum (readonly)

Returns the constant alignment value used to pad the serialized load command.

Returns:

  • (Fixnum)

    the constant alignment value used to pad the serialized load command



302
303
304
# File 'lib/macho/load_commands.rb', line 302

def alignment
  @alignment
end

#endiannessSymbol (readonly)

Returns the endianness of the serialized load command.

Returns:

  • (Symbol)

    the endianness of the serialized load command



299
300
301
# File 'lib/macho/load_commands.rb', line 299

def endianness
  @endianness
end

Class Method Details

.context_for(macho) ⇒ MachO::LoadCommands::LoadCommand::SerializationContext

Returns the resulting context.

Parameters:

Returns:



306
307
308
# File 'lib/macho/load_commands.rb', line 306

def self.context_for(macho)
  new(macho.endianness, macho.alignment)
end