Exception: WCC::Contentful::CircularReferenceError
- Inherits:
-
StandardError
- Object
- StandardError
- WCC::Contentful::CircularReferenceError
- Defined in:
- lib/wcc/contentful/exceptions.rb
Overview
Raised when an entry contains a circular reference and cannot be represented as a flat tree.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#stack ⇒ Object
readonly
Returns the value of attribute stack.
Instance Method Summary collapse
-
#initialize(stack, id) ⇒ CircularReferenceError
constructor
A new instance of CircularReferenceError.
- #message ⇒ Object
Constructor Details
#initialize(stack, id) ⇒ CircularReferenceError
Returns a new instance of CircularReferenceError.
17 18 19 20 21 |
# File 'lib/wcc/contentful/exceptions.rb', line 17 def initialize(stack, id) @id = id @stack = stack.slice(stack.index(id)..stack.length) super('Circular reference detected!') end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
15 16 17 |
# File 'lib/wcc/contentful/exceptions.rb', line 15 def id @id end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
15 16 17 |
# File 'lib/wcc/contentful/exceptions.rb', line 15 def stack @stack end |
Instance Method Details
#message ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/wcc/contentful/exceptions.rb', line 23 def return super unless stack super + "\n " \ "#{stack.last} points to #{id} which is also it's ancestor\n " + stack.join('->') end |