Exception: Eddy::Errors::ElementValidationError
- Defined in:
- lib/eddy/errors.rb
Overview
Exception raised by descendents of Eddy::Element::Base.
Direct Known Subclasses
ElementNilValueError, LengthValidationError, TypeValidationError
Element Validation Errors collapse
-
#arg ⇒ Object
Argument that caused the exception when passed to
value=. -
#element ⇒ Eddy::Element::Base
Element instance that raised the exception.
Element Validation Errors collapse
Constructor Details
#initialize(msg = "", element: nil) ⇒ void
19 20 21 22 23 |
# File 'lib/eddy/errors.rb', line 19 def initialize(msg = "", element: nil) self.element = element unless element.nil? msg = "Invalid value assigned to element #{element_description()}. " << msg super(msg) end |
Instance Attribute Details
#arg ⇒ Object
Argument that caused the exception when passed to value=. (if applicable)
14 15 16 |
# File 'lib/eddy/errors.rb', line 14 def arg @arg end |
#element ⇒ Eddy::Element::Base
11 12 13 |
# File 'lib/eddy/errors.rb', line 11 def element @element end |
Instance Method Details
#element_description ⇒ String
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/eddy/errors.rb', line 26 def element_description() el = self.element return "" if el.nil? description = "" if !el.ref.nil? && el.ref.length > 0 description << el.ref else description << el.class.name.split("::").last end description << " (#{el.name})" return description end |