Exception: WLang::UndefinedVariableError

Inherits:
EvalError show all
Defined in:
lib/wlang/errors.rb

Overview

Raised when a variable may not be found in the current parser scope

Instance Attribute Summary (collapse)

Attributes inherited from EvalError

#expression

Attributes inherited from Error

#cause, #parser_state

Instance Method Summary (collapse)

Methods inherited from Error

#wlang_backtrace

Constructor Details

- (UndefinedVariableError) initialize(msg = nil, parser_state = nil, expression = nil, variable = nil)

Creates an error instance with an optional variable name



61
62
63
64
# File 'lib/wlang/errors.rb', line 61

def initialize(msg = nil, parser_state = nil, expression = nil, variable = nil)
  super(msg, parser_state, expression)
  @variable = variable
end

Instance Attribute Details

- (Object) variable

Name of the variable that could not be found



58
59
60
# File 'lib/wlang/errors.rb', line 58

def variable
  @variable
end

Instance Method Details

- (Object) to_s



66
67
68
# File 'lib/wlang/errors.rb', line 66

def to_s
  "Unable to find variable #{@variable}"
end