Exception: RVM::Interpreter::RuntimeError

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, total = nil, line = nil, char = nil) ⇒ RuntimeError

Returns a new instance of RuntimeError.



23
24
25
26
27
28
29
# File 'lib/rvm/interpreter.rb', line 23

def initialize message, total = nil, line = nil, char = nil
  super()
  @line = line
  @char = char
  @total = total
  @error_message = message
end

Instance Attribute Details

#charObject

Returns the value of attribute char.



22
23
24
# File 'lib/rvm/interpreter.rb', line 22

def char
  @char
end

#error_messageObject

Returns the value of attribute error_message.



22
23
24
# File 'lib/rvm/interpreter.rb', line 22

def error_message
  @error_message
end

#lineObject

Returns the value of attribute line.



22
23
24
# File 'lib/rvm/interpreter.rb', line 22

def line
  @line
end

#totalObject

Returns the value of attribute total.



22
23
24
# File 'lib/rvm/interpreter.rb', line 22

def total
  @total
end

Instance Method Details

#to_sObject



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/rvm/interpreter.rb', line 31

def to_s
  res = "Runtime error"
  if @total or @line
    res << " at"
  end
  if @total
    res << " character #{@total}"
  end
  if @line
    res << " line #{@line}"
  end
  if @char
    res << ":#{@char}"
  end
  res << ": #{@error_message}"
  res
end