Exception: RVM::Interpreter::ReturnException

Inherits:
Exception
  • Object
show all
Defined in:
lib/rvm/interpreter.rb

Overview

This is an exception designed to handle the return statement. It is thrown for for the return and the value can be evaluated.

The catching is handled bythe RVM::Classes::Block class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(val, pos = nil) ⇒ ReturnException

The ReturnException is initialized wiht 1 to 2 parameters.

val

The value that will be returned, aka the part after ‘return’.

pos

The position within the source code of the definition - for deugging purpose.



803
804
805
806
807
# File 'lib/rvm/interpreter.rb', line 803

def initialize val, pos = nil
  super()
  @val = val
  @pos = pos
end

Instance Attribute Details

#posObject (readonly)

Returns the value of attribute pos.



795
796
797
# File 'lib/rvm/interpreter.rb', line 795

def pos
  @pos
end

#valObject (readonly)

Returns the value of attribute val.



794
795
796
# File 'lib/rvm/interpreter.rb', line 794

def val
  @val
end