Class: Rjq::Instruction

Inherits:
Struct
  • Object
show all
Defined in:
lib/rjq/opcodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#arg1Object

Returns the value of attribute arg1

Returns:

  • (Object)

    the current value of arg1



14
15
16
# File 'lib/rjq/opcodes.rb', line 14

def arg1
  @arg1
end

#arg2Object

Returns the value of attribute arg2

Returns:

  • (Object)

    the current value of arg2



14
15
16
# File 'lib/rjq/opcodes.rb', line 14

def arg2
  @arg2
end

#locObject

Returns the value of attribute loc

Returns:

  • (Object)

    the current value of loc



14
15
16
# File 'lib/rjq/opcodes.rb', line 14

def loc
  @loc
end

#opObject

Returns the value of attribute op

Returns:

  • (Object)

    the current value of op



14
15
16
# File 'lib/rjq/opcodes.rb', line 14

def op
  @op
end

Instance Method Details

#to_sObject



15
16
17
18
# File 'lib/rjq/opcodes.rb', line 15

def to_s
  text = [Opcodes::MNEMONICS.fetch(op), format_arg(arg1), format_arg(arg2)].compact.join(' ')
  loc ? "#{text} @ #{loc.filename}:#{loc.line}:#{loc.column}" : text
end