Exception: Yay::AlreadyAssignedError

Inherits:
Error
  • Object
show all
Defined in:
lib/yay/errors.rb

Overview

this error is raised when a variable has already been assigned a value for example @x is red and @x is blue

Instance Attribute Summary collapse

Attributes inherited from Error

#position

Instance Method Summary collapse

Methods inherited from Error

#printable_position

Constructor Details

#initialize(variable) ⇒ AlreadyAssignedError

Returns a new instance of AlreadyAssignedError.



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

def initialize variable
  @variable = variable
end

Instance Attribute Details

#variableObject (readonly)

Returns the value of attribute variable.



64
65
66
# File 'lib/yay/errors.rb', line 64

def variable
  @variable
end

Instance Method Details

#printable_messageObject



70
71
72
# File 'lib/yay/errors.rb', line 70

def printable_message
  return "The variable #{variable} has already been assigned a value#{printable_position}"
end