Exception: Yay::CircularReferenceError

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

Overview

raised when there’s a circular reference between rules. this happens when variables point back to themselves in some way. e.g. @x is @y and @y is @x

Instance Attribute Summary collapse

Attributes inherited from Error

#position

Instance Method Summary collapse

Methods inherited from Error

#printable_position

Constructor Details

#initialize(current, path) ⇒ CircularReferenceError

Returns a new instance of CircularReferenceError.



98
99
100
101
# File 'lib/yay/errors.rb', line 98

def initialize current, path
  @current = current
  @path    = path
end

Instance Attribute Details

#currentObject (readonly)

Returns the value of attribute current.



95
96
97
# File 'lib/yay/errors.rb', line 95

def current
  @current
end

#pathObject (readonly)

Returns the value of attribute path.



96
97
98
# File 'lib/yay/errors.rb', line 96

def path
  @path
end

Instance Method Details

#printable_messageObject



103
104
105
# File 'lib/yay/errors.rb', line 103

def printable_message
  return "There is a circular reference between variables: #{path.join(' => ')} => #{current}#{printable_position}"
end