Class: Ronin::Arch

Inherits:
Object
  • Object
show all
Includes:
Model, Model::HasUniqueName
Defined in:
lib/ronin/arch.rb

Overview

Represents a Computer Architecture and pre-defines many other common architectures (x86, x86_64, ia64, ppc, ppc64, sparc, sparc64, mips and arm).

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Model::HasUniqueName

included

Methods included from Model

included

Class Method Details

.predefine(name, options = {}) ⇒ Object

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.

Defines a new pre-defined Arch.

Examples:

Defining a pre-defined Arch

Arch.predefine :alpha, :endian => :big, :address_length => 8

Retrieving a pre-defined Arch

Arch.alpha

Parameters:

  • name (Symbol, String)

    The name of the architecture.

  • options (Hash) (defaults to: {})

    Additional options.

Options Hash (options):

  • :endian (Symbol, String)

    The endianness of the architecture.

  • :address_length (Integer)

    The address-length of the architecture.



92
93
94
# File 'lib/ronin/arch.rb', line 92

def self.predefine(name,options={})
  super(name,{:name => name}.merge(options))
end

Instance Method Details

#to_aryArray

Splats the architecture into multiple variables.

Examples:

endian, address_length = Arch.x86

endian
# => 'little'
address_length
# => 4

Returns:

  • (Array)

    The #endian and #address_length of the architecture.

Since:

  • 1.0.0



65
66
67
# File 'lib/ronin/arch.rb', line 65

def to_ary
  [self.endian, self.address_length]
end