Class: Ronin::Code::ASM::Instruction
- Inherits:
-
Struct
- Object
- Struct
- Ronin::Code::ASM::Instruction
- Defined in:
- lib/ronin/code/asm/instruction.rb
Overview
Represents an instruction.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#operands ⇒ Object
Returns the value of attribute operands.
Instance Method Summary collapse
-
#initialize(name, operands) ⇒ Instruction
constructor
Initializes the instruction.
-
#width ⇒ Integer?
The word size of the instruction.
Constructor Details
#initialize(name, operands) ⇒ Instruction
Initializes the instruction.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/ronin/code/asm/instruction.rb', line 40 def initialize(name,operands) operands = operands.map do |value| case value when Integer, nil then ImmediateOperand.new(value) else value end end super(name,operands) end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
29 30 31 |
# File 'lib/ronin/code/asm/instruction.rb', line 29 def name @name end |
#operands ⇒ Object
Returns the value of attribute operands
29 30 31 |
# File 'lib/ronin/code/asm/instruction.rb', line 29 def operands @operands end |
Instance Method Details
#width ⇒ Integer?
The word size of the instruction.
57 58 59 60 61 |
# File 'lib/ronin/code/asm/instruction.rb', line 57 def width self.operands.map { |op| op.width if op.respond_to?(:width) }.compact.max end |