Exception: RLTK::TypeMismatch

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rltk/ast.rb

Overview

A TypeMismatch is raised when an object being set as a child or value of an ASTNode is of the wrong type.

Instance Method Summary collapse

Constructor Details

#initialize(expected, actual) ⇒ TypeMismatch

Instantiates a new TypeMismatch object.

Parameters:

  • expected (Class)

    Expected type.

  • actual (Klass)

    Actual type of object.



26
27
28
29
# File 'lib/rltk/ast.rb', line 26

def initialize(expected, actual)
	@expected	= expected
	@actual	= actual
end

Instance Method Details

#to_sString

Returns String representation of the error.

Returns:

  • (String)

    String representation of the error.



32
33
34
# File 'lib/rltk/ast.rb', line 32

def to_s
	"Type Mismatch: Expected #{@expected} but received #{@actual}."
end