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.
51 52 53 54 55 |
# File 'lib/wcc/contentful/exceptions.rb', line 51 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.
49 50 51 |
# File 'lib/wcc/contentful/exceptions.rb', line 49 def id @id end |
#stack ⇒ Object (readonly)
Returns the value of attribute stack.
48 49 50 |
# File 'lib/wcc/contentful/exceptions.rb', line 48 def stack @stack end |
Instance Method Details
#message ⇒ Object
57 58 59 60 61 62 63 |
# File 'lib/wcc/contentful/exceptions.rb', line 57 def return super unless stack super + "\n " \ "#{stack.last} points to #{id} which is also it's ancestor\n " + stack.join('->') end |